GridView, GridLayout or TableLayout?
Solution 1
GridView is scrollable. it would only make sense to use GridView if you load all of the buttons at once and drop the previous and next buttons.
GridLayout is the way to go.
Solution 2
Personally I would think the best way to do this is to create a Relative Layout in code. Get the screen width and height. divide width by 4 divide height by 2 then call
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(args to make fit screen and be in order);
myRelativeLayout.addView(lp);
and set the images in the order you want. to get the gaps use images that have alpha so the edges make the gap.
then call
invalidate()
but that is just me. :)
check out some other places like How to lay out Views in RelativeLayout programmatically?
Carlos Pereira
Updated on July 29, 2022Comments
-
Carlos Pereira almost 2 years
I need to create some screens similar to this one:
Also, if the user wants to show more buttons per screen, it would be something like this:
Today I am using LinearLayouts to do this.
I would like to know which option is the best to develop a design like the above.
User must not swype up or down to see the rest of buttons, the rest of buttons will be shown through the navigation buttons (don't worry, I will use a Viewflipper to do this)
Buttons must use all the screen and must have the same size. They must resize itself if images are big to fit the screen size
Lightweight. Low consumption of memory
Buttons when clicked may open new grids
What is the best option for this? GridView, GridLayout or TableLayout?
Thank you in advance!
-
Sarvesh almost 11 yearsAny idea how did you decide on that? I need an example. Also how did the resize work?