简体   繁体   中英

reload list contents on click of a button

i am trying to develop this app in android that has 3-4 buttons and a list being displayed below them. each button when clicked must reload the list with new contents based on which button was clicked. each row in the list has a picture and two lines of text. could some one please suggest me how do I perform the reloading part.

将具有更新的元素的新适配器与listView附加在一起,它将像重新加载列表视图一样工作……

You could grab the list, in whatever layout it is in (ex LinearLayout) by doing a:

LinearLayout ll = (LinearLayout)getViewById(R.id.thislayout)

Remove the elements from the list as you desire using:

ll.removeView(view);

edit the view object as you want (changing the source etc) then re-add it to the LinearLayout using:

ll.addView(view);

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