Multi-line Listview in Android [duplicate]
Hello I have a multi choice listview. I would like to add more than one line of text to each list item. e.g.
List Item 1
SubtextWith subtext being smaller text. etc.
I can't find a solid example of this bar making my own custom list adapter which adds complications for multi select and is sort of over my head. The way I add items currently is
private static final String[] items={"my", "name", "is", "mark", "i", "am", "testing", "lists"};
theList = new开发者_JAVA技巧 ArrayAdapter<String>(this,
android.R.layout.simple_list_item_multiple_choice, items);
setListAdapter(theList);
Is there any way to do this?
I was looking for a solution for multi-line ListView and came across this post. The link above no longer works, but I found the following: http://saigeethamn.blogspot.com/2010/04/custom-listview-android-developer.html
The solution here worked just fine for me. If you'e building the list dynamically, as I am, just iterate through your data to build an array of HashMaps.
~Happy coding
You are going to have to create a custom list adapter.
Start by checking out this example and if you still have problems post a new question with your code that you have tried.
Edit: New link. Checkout this question for an example. Custom Adapter for List View
精彩评论