问题
I have a ListView
. on click of a list item I start a Activity
. Now I have added a Button
on that ListView
and onclick of a button I want to start a another activity. After adding a Button, I can click on the button and start a Activity but now I can not click a list item. What happened to listview's item click ??
回答1:
Read this excellent blog post: Focus problems with list rows and ImageButtons
Essentially you should add the following to your root layout element in the row-item xml.
android:descendantFocusability="blocksDescendants"
回答2:
that is the concept. If u want to implement both clicks then write button click normally and for list item click did not use the listitem click.
Instead that you write onclick listener for converted view that you returned in getview()
Then both clicks will work
来源:https://stackoverflow.com/questions/7533027/button-click-and-listview-click