Android listview toggle button

后端 未结 2 1236
梦谈多话
梦谈多话 2021-01-16 06:50

I have a Listview that will list the alarms which are in the database.I need to add a Toggle Button beside each list item to set the alarm on/off

2条回答
  •  终归单人心
    2021-01-16 07:01

    Try creating a custom adapter like:

    public class YourAdapter extends BaseAdapter
    

    and a custom layout for the rows with a toggle button (you will have to inflate the layout in the method geView).

    Here you can find an example: http://www.softwarepassion.com/android-series-custom-listview-items-and-adapters/

    Hope this helps..

提交回复
热议问题