简体   繁体   中英

Custom Item in ListActivity on Android

I've spent hours reading through the SDK reference, googling and reading tutorials - but I still can't figure it out.

I would like to know how to create a custom list item in the ListActivity widget on Android. Something similar to a Twitter client interface. Each list item has different types of text, possibly an icon, etc.

The issue is binding the data to the list item. If you define your own data structure, let's say "Tweet" which will store the message, author, date sent and a picture URL - how do you bind the tweet instance to the custom list item?

Does anyone know of any resources that would help me understand the process of creating something like that?

Any guidance would be appreciated. Thanks

I'm not sure which tutorials you were reading but it's quite simple. You define your layout. You use it in your getView for your items. http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/List14.html

you can also look at Mark's example with lazy loading images http://github.com/commonsguy/cwac-thumbnail

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM