Android Lollipop Lands for the Sony Xperia Z Ultra

The undisputed king of the beasts–at least in Sony’s current stable,is the … more

Android 5.0 Lollipop in 3D–EVO 3D, That Is!

It is that time of the year once again. Flowers bloom (or snow falls, depending on which … more

Gaming Console with Lollipop? Ouya Gets an Android TV Port

Android is a very flexible platform, and it can be used on a large variety of … more

Android App Review: Manage Your Connections Automagically – XDA TV

Material Design is all the buzz in the Android world right now. … more

Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

[Library] Simple GridLayout

OP EatHeat

15th September 2013, 01:54 PM   |  #1  
EatHeat's Avatar
OP Recognized Developer
Flag Calcutta
Thanks Meter: 1,427
 
914 posts
Join Date:Joined: Jan 2013
More
Often we find ourselves messed up with simple things such as layouts.

So I made this library modifying AOSP code to help put items in a Grid Layout.

You can add this as a library or put it separately into your package since it consists of just a single Java file.

Its pretty simple and extremely easy to use. Just put the items in xml between the following tags:


Code:
<tk.eatheat.gridlayout.GridLayout>
....
</tk.eatheat.gridlayout.GridLayout>
By default, it creates a 3x3 grid. To change it just set the number of rows and columns in these lines:

Code:
static private final int COLUMNS = 3;
static private final int ROWS = 3;
Here's a sample app made with the library to show the result.

Quote:


Sample app can be found here.

Library can be found here on my Github here.


-------------------------------

Featured on Portal:

http://www.xda-developers.com/androi...le-gridlayout/
Last edited by EatHeat; 22nd September 2013 at 03:38 AM.
The Following 14 Users Say Thank You to EatHeat For This Useful Post: [ View ]
16th September 2013, 08:20 PM   |  #2  
nikwen's Avatar
Recognized Contributor
Thanks Meter: 1,398
 
2,791 posts
Join Date:Joined: Feb 2013
More
Hey, cool library.

Thanks.
16th September 2013, 08:46 PM   |  #3  
sheennick123456's Avatar
Senior Member
Flag MUMBAI
Thanks Meter: 32
 
789 posts
Join Date:Joined: Dec 2007
Donate to Me
More
I recently started hobby android app development and this was the thing that always bothered me the most !

Thanks a ton ! this saves me a lot of effort and simplifies everything
17th September 2013, 04:06 AM   |  #4  
EatHeat's Avatar
OP Recognized Developer
Flag Calcutta
Thanks Meter: 1,427
 
914 posts
Join Date:Joined: Jan 2013
More
Quote:
Originally Posted by sheennick123456

I recently started hobby android app development and this was the thing that always bothered me the most !

Thanks a ton ! this saves me a lot of effort and simplifies everything

You are welcome. Glad to be of help.
The Following User Says Thank You to EatHeat For This Useful Post: [ View ]
17th September 2013, 09:58 AM   |  #5  
m4RinKo2's Avatar
Senior Member
Thanks Meter: 461
 
831 posts
Join Date:Joined: Oct 2012
More
Quote:
Originally Posted by EatHeat

You are welcome. Glad to be of help.

Could you add activity starter to buttons?

Sent from my GT-S5570I using xda app-developers app
17th September 2013, 03:02 PM   |  #6  
EatHeat's Avatar
OP Recognized Developer
Flag Calcutta
Thanks Meter: 1,427
 
914 posts
Join Date:Joined: Jan 2013
More
@m4RinKo2
Code:
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setComponent(newComponentName("com.package.app","com.package.app.ExampleActivity"));
startActivity(intent);
Set intent on the buttons with the correct package and activity names.
The Following User Says Thank You to EatHeat For This Useful Post: [ View ]
19th September 2013, 04:12 AM   |  #7  
Akshay (Aky)'s Avatar
Senior Member
Flag Pune
Thanks Meter: 578
 
818 posts
Join Date:Joined: Jul 2012
More
Thanks for your hard-work.
This library will be surely somewhere used by me.

Sent from my GT-I9300 using XDA Premium 4 mobile app

Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes