简体   繁体   中英

Click on an edit button and delete button appear next to each item in the listview

I want to have a Button at the top of my ListView and when i click on it, a little delete Button should appear on each item in the ListView . And then an AlertDialog should appear when I press on the little delete button.

Could someone point me in the right direction on how to do this? Please

You have to create ListView with custom adapter.

Here is pretty good tutorial http://www.vogella.com/tutorials/AndroidListView/article.html

You just have to follow the following steps:

  • First of all make a layout consists of ListView with a button top of it.
  • Make a custom row (with small delete button) which will be add in a ListView through CustomAdapter.
  • Then Make a functionality of opening a dialog on click of a button.
  • Finally Combine all above steps into one.

And you are done.

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