开发者

Need to make a List [closed]

开发者 https://www.devze.com 2023-02-12 09:19 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. 开发者_运维技巧 Closed 10 years ago.

Need to make a List that each line have Image and data (text)

what is the right way? with list of table row ? or it is possible with ListView?

thanks for your help


A ListView is the easiest if you don't know the length of the list, and/or you want it scrolling.

If you have a list and you want to control the height (e.g.: 1 page etc), you might not be the best off with a listview, but better take a relative- or linear layout, possibly in a scrollview (but then, if you have a scrollview, you probably stopped at listview ;) )


The ListView is the way to go, it will take care of releasing the memory and it will be faster to draw and to process.

You can follow this tutorial in order to build the basic structure. Then modify the list_item.xml file (or however you named it) in order to fit your layout. Then, use a custom adapter, you can extend ArrayAdapter<item>, for example, and there you can build the rows as needed

For example, you can have a RelativeLayout with an ImageView aligned to the left, and the TextView in the right. This layout is going to be reused in every row.

This is a tutorial that you can follow to create it.

If you feel like make it more efficient, watch this video that can help you optimize your ListView.

I hope that helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消