display several items in one row of a listview in android
I don't now if this title is very clear, b开发者_开发技巧ut I would like to understand how this is possible :
(source: android.com)And how we can have 2 elements on the same row of the listview, and handle different clicks, as the listview deals with handling the click on a child.
Thanks for anyone who could point me in the right direction.
Anytime that you need anything more than a basic list of text you have to define in an XML file what your list items will look like. They can have anything you want in them when you define them. In your above example you could achieve something similar by defining a list item with two static text items, and two images. You can register listeners on individual components so that when the user taps the left image it opens the left link, and so on.
Here's a tutorial I found on the topic, and there are many more out there that are better.
Just make sure you understand how to re-inflate old items in your list that go out of view, and how to make an adapter for your list items.
When you create your ListAdapter you can pass in a layout to use for the List Items. In this layout you can specify any UI objects you wish, int this case Image and Text views.
You should use a GridView rather than a ListView in this case. Check it out here : http://developer.android.com/reference/android/widget/GridView.html
精彩评论