In fact, a lot of things are not paste code can be solved, do anything to do it attentively, so as to sleep at night more practical.
When you paste someone else's code, sometimes out of the bug is really annoying, but when you understand the point of principle, can see the essence of the problem, solve it is also very handy to start today's theme. When you see this problem, you should know where the problem is, and use the button in the ListView ( Of course not only button, but also ImageButton and other self-response click View, the problem arises, you will find the ListView item can not click, specifically because of what? Most of the reason is the focus, The button grabbed the item's focus so that item could not respond to the Click event, so how to fix it? The first protagonist of the Day (descendantfocusability) is going to be a shining debut ...
The android:descendantfocusability has three values, namely: beforedescendants,afterdescendants,blocksdescendants
1.android:descendantfocusability= "beforedescendants" means that the ListView item gets the focus first.
2.android:descendantfocusability= "afterdescendants" only button does not need focus when item gets focus
3.android:descendantfocusability= "Blocksdescendants" Item overrides button to get focus directly
See the effect of these three properties you should know how to solve the problem, the ListView and button when the focus of the grab I used to use the third, and then write the button in the adapter onclick event, so that everyone who do not provoke anyone, peace together.
Use the button workaround in Android listview