Android - buttons inside listview elements

2.8k views Asked by At

I intend to use button inside listview items, however I have not see much apps doing so and sdk also does not provide any straightforward way to do so, I am assuming that it conflicts some of the HCI guidlines or there must be some reason for this, are there any specific points because of which this is not implemented such.

2

There are 2 answers

1
Ashen Randika On BEST ANSWER

I dont see any issue using buttons inside a ListView. For example you can use toggle buttons for settings activity.. As mentioned in the Joost's answer you have to use an Adapter and a layout for implementing this.. You can some other related answers from here and here. You may refer this article as well..

0
Joost On

You probably want to create your own ListAdapter and XML for the layout of the list items. This tutorial explains how to create your own ListAdapter and XML: Custom ListView items and adapters. Inside the ListAdapter you should add the code to control the button.