Search code examples
androidandroid-layoutandroid-viewpagerwallpaper

Android wallpaper program layouts


When I look at several of the more popular android walpaper programs, (HD Wallpapers and the like), they all seem to have a very similar layout with 4 pictures in a 2 x 2 grid where each takes up approximately 1/2 of the parent's respective width and height. After not having a lot of success emulating this with various combinations of layouts and objects, I am trolling for a pointer. Anyone who could get me pointed in the right direction would be greatly appreciated. Is there a standard mix to achieve this sort of view?

Side note: Please be gentle, it's my first time... asking a question. ;)


Solution

  • You could use a GridView with android:numColumns=2.

    You can see a GridView example here. You would set the height by manipulating the LayoutParams on the views that you put inside the GridView (via its Adapter).

    If that doesn't float your boat and you're not doing much scrolling, you can always create a TableLayout with TableRows of 2 Views apiece, or a vertical LinearLayout containing two horizontal LinearLayouts of 2 Views apiece.

    What have you tried already? Can you expand on your use case a little bit more? Do the images need to scroll? Can they be static? Will there be more than 4 images on a page?