I want to create a journal that appears as a list in a ListView
. The list should be able to have a text entry or an image for each row. Now, I have these entries (text and image) in a database. I just want to know how to create a list adapter which can have these entries. 开发者_StackOverflowFrom the examples I have seen, the list adapters all have only one data type. I want my adapter to have data type image
or text
. Please Help! Been searching for 3 hours now.
To show images in some listItems and text in others, declare both an ImageView and a TextView in the listitem xml, and hide/show one of them with View.setVisibility(...), where you bind the content. For examples of multiple children in a listItem, refer to other Nik's answer
精彩评论