How do i create this kind of views in my application? (The screenshot is actually of an android application available in android market).
I am confused as i assume that we can create the same kind of layout either by using Gridview or by using ListView.
From your expert side, please suggest me a possible solution to design and create the same kind of layouts for the android application.
The main difference between ListView and GridView is how it lays out its child. With ListView you are laying your children one by one either vertically or horizontally only. With GridView, its a combination of both. It lays its children horizontally first.
A view that shows items in two-dimensional scrolling grid. The items in the grid come from the ListAdapter associated with this view.
List view provides users a format that follows their natural reading patterns like the F-shaped pattern, while grid view is a little more interruptive, making it best suited for visual content. You can jump from one image to the next without worrying about order or continuity.
Android GridView shows items in two-dimensional scrolling grid (rows & columns) and the grid items are not necessarily predetermined but they automatically inserted to the layout using a ListAdapter.
Look at the code of Shelves, written by Romain Guy (one of the ListView's creator).
He used a GridView:
no separator
background is a bitmap drawable
< bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/shelf_panel" android:tileMode="repeat" />
background image is like this:
The code is worth a look because it contains other interesting solutions, too.
Stated problems:
In Gridview, can we give separator between two rows? can we give background to each row in gridview?
Well, you can always make up a separator by adding something on the bottom of your view. Make it so that it 'connects' on the sides, and you won't know the difference. It will cost you an extra view per grid-item, so probably not the best option.
In Listview, i think we can customize the listview with 3 books in a row with background, and we can give a separator as well.
Eeuhm, yes, although I don't see what the problem is?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With