ListView: how to access Item's elements programmatically from outside?

前端 未结 6 1002
长情又很酷
长情又很酷 2021-01-22 02:17

I have the following situation.

I have a ListView, each item of the ListView is comprised of different widgets (TextViews, ImageViews, etc...) inflated form a Layout in

6条回答
  •  执念已碎
    2021-01-22 02:35

    User EasyListViewAdapters library https://github.com/birajpatel/EasyListViewAdapters

    Features

    1. Easier than implementing your own Adapter (ie handling BaseAdaper#getView).Very Easier to provide multi-row support.
    2. Library takes care of recycling all views, that ensures performance & helps your list view scroll smoothly.
    3. Cleaner code. By keeping different RowViewSetter classes for different row-types makes your code easy to manage & easy to reuse.
    4. No data browsing, Library takes care of browsing data through data-structure when View is being drawn or event occurs so that Users does not have to look for their data to take actions.
    5. Just by passing correct row-types library will Auto-map your data-types to row-types to render views. Row views can be created by using XML or Java (doesn't restrict to XML-Only Approach).
    6. Load More callbacks can be registered to implement paginatation support to your list.
    7. Handling children viewclicks, you can also register for Children(present inside your rows) view click events.
    8. All these Views are registered with single OnClickListner so that this mechanism is very memory efficient when click event occurs users you gets clickedChildView, rowData,int eventId as callback params.

    enter image description hereenter image description hereenter image description here

提交回复
热议问题