5,600,335 Members 35,095 Now Online
XDA Developers Android and Mobile Development Forum

[Library] Simple GridLayout

Tip us?
 
EatHeat
Old
(Last edited by EatHeat; 22nd September 2013 at 02:38 AM.)
#1  
EatHeat's Avatar
Recognized Developer - OP
Thanks Meter 1316
Posts: 901
Join Date: Jan 2013
Location: Calcutta
Default [Library] Simple GridLayout

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/
[3.0+]Crius.
Customize your clock.


[2.2+]SnowBowl HD.
Enjoy the vacations!


The Following 13 Users Say Thank You to EatHeat For This Useful Post: [ Click to Expand ]
 
sheennick123456
Old
#3  
sheennick123456's Avatar
Senior Member
Thanks Meter 31
Posts: 787
Join Date: Dec 2007
Location: MUMBAI

 
DONATE TO ME
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
 
EatHeat
Old
#4  
EatHeat's Avatar
Recognized Developer - OP
Thanks Meter 1316
Posts: 901
Join Date: Jan 2013
Location: Calcutta
Quote:
Originally Posted by sheennick123456 View Post
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.
[3.0+]Crius.
Customize your clock.


[2.2+]SnowBowl HD.
Enjoy the vacations!


The Following User Says Thank You to EatHeat For This Useful Post: [ Click to Expand ]
 
m4RinKo2
Old
#5  
m4RinKo2's Avatar
Senior Member
Thanks Meter 411
Posts: 755
Join Date: Oct 2012
Quote:
Originally Posted by EatHeat View Post
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
 
EatHeat
Old
#6  
EatHeat's Avatar
Recognized Developer - OP
Thanks Meter 1316
Posts: 901
Join Date: Jan 2013
Location: Calcutta
@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.
[3.0+]Crius.
Customize your clock.


[2.2+]SnowBowl HD.
Enjoy the vacations!


The Following User Says Thank You to EatHeat For This Useful Post: [ Click to Expand ]
 
Akshay (Aky)
Old
#7  
Akshay (Aky)'s Avatar
Senior Member
Thanks Meter 450
Posts: 740
Join Date: Jul 2012
Location: Pune
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
Automaton : Intelligent Gestures & Lock / Unlock
Active Notify : Moto X Active Display




Developing to make life easier

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


XDA PORTAL POSTS

Intelligently Place Contacts on Your Home Screen with CallWho Widget

There are plenty of ways to get your contacts to show up on your … more

Control TWRP from within Android with TWRP Coordinator

You may recall that back when TWRP2 introduced a couple of years ago, it brought with … more

Keep Track of Everything Your Device Does with Event Logger

Regardless of their OS choice, computing power users generally share one common … more

A More Competitive Spin on the Addictive 2048 Puzzle

You may recall that a few weeks ago, we talked about a rather interesting take on … more