Istview button preemption Focus Solution:
Item XML root node add android:descendantfocusability= "Blocksdescendants"
Button settings
Android:focusable= "false"
Click the button and ListView Item to respond to your own click events individually
Development of a very common problem, the project ListView not only simple text, often need to define their own ListView, their own adapter to inherit Baseadapter, in the adapter in accordance with the needs of the writing, the problem appeared, May occur when clicking on each item when there is no response and cannot get the focus.
Most of the reason is that there are child controls such as Imagebutton,button,checkbox (or a Button or checkable subclass control) in your own defined item, at which point the child controls get the focus, So often when you click on the item, the child controls change, and the item itself is clicked without responding.
Then you can use descendantfocusability to solve it.
This property is the relationship between the ViewGroup and its child controls when a view gets the focus.
The value of the property has three kinds:
Beforedescendants:viewgroup takes precedence over its child class controls and gets the focus
Afterdescendants:viewgroup gets focus only when its subclass control does not need to get focus
Blocksdescendants:viewgroup overrides the subclass control and gets the focus directly
Usually we use a third, that is, in the item layout of the root layout plus **android:descendantfocusability= "blocksdescendants" * * property is good, so listview click on the supernatural event.
The above is a small set to introduce the ListView button to seize the focus of the solution, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!