FORUMS

How to Root the LG G4 and Install TWRP Recovery – XDA TV

A rooting method has finally been found for the flagship LG G4. In this … more

New Xposed for Lollipop 5.0 Update Fixes Major Bugs

Senior Recognized Developer rovo89 has patched Xposed for Lollipop 5.0 to … more

Download Sony’s new AOSP-like concept for Xperia Z3

Over in our forums, Recognized Contributor Jozinek has posted a very … more

OnePlus 2 vs Moto X Style: Which is The Better Flagship?

Two big industry names have announced their newest flagship phones within the … more

[Library] Simple GridLayout

914 posts
Thanks Meter: 1,460
 
Post Reply Subscribe to Thread Email Thread
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 02:38 AM.
The Following 14 Users Say Thank You to EatHeat For This Useful Post: [ View ]
 
 
16th September 2013, 07:20 PM |#2  
nikwen's Avatar
Recognized Contributor
Thanks Meter: 1,569
 
More
Hey, cool library.

Thanks.
16th September 2013, 07:46 PM |#3  
sheennick123456's Avatar
Senior Member
Flag MUMBAI
Thanks Meter: 32
 
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, 03:06 AM |#4  
EatHeat's Avatar
OP Recognized Developer
Flag Calcutta
Thanks Meter: 1,460
 
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, 08:58 AM |#5  
m4RinKo2's Avatar
Senior Member
Thanks Meter: 461
 
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, 02:02 PM |#6  
EatHeat's Avatar
OP Recognized Developer
Flag Calcutta
Thanks Meter: 1,460
 
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, 03:12 AM |#7  
Akshay (Aky)'s Avatar
Senior Member
Flag Pune
Thanks Meter: 691
 
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