The ListItem in the ListView sets the event response, and if there is a button control in ListItem, the Click event is not captured by ListItem, and the button in ListItem captures the click event. So what if you click on the button in ListItem to see which item the button is in, in other words, click the button in the ListItem to get the ListItem index? Given this index, the value inside the item is relatively easy.
The following methods can be implemented:
1. When the button is initialized in ListItem, add a SetPosition method to the button, pass in the index value at this time, and then call the view's GetPosition method in the button's onclick event. You can read the index of the ListItem in the following code:
Tagbutton.setpsition (position); The Tagbutton here is defined as the button,position is the position inside the view.
2. When the button is initialized, the index value of an item is passed through the SetPosition method
Private Onclicklistener Tagbuttononclick = new Onclicklistener () {
public void OnClick (View v) {
Final int index = (Integer) v.getposition ();
}}Index is the position in the item where the button is clicked, where you can get the value in the item.
The button control in the ListView gets the index of the item