Trying to catch a click on android ListView item: android:descendantFocusability=“blocksDescendants” not working

后端 未结 3 668
忘了有多久
忘了有多久 2020-12-05 15:34

This has been addressed in many posts on StackOverflow. The most recommended solution is to set:

android:descendantFocusability=\"blocksDescendants\"
         


        
3条回答
  •  悲&欢浪女
    2020-12-05 15:50

    Try using this inside each button layouts

     android:focusable="false"
    android:focusableInTouchMode="false"
    

    and remove other thing which you are doing for this. Also from listview. Also remove this

    android:descendantFocusability="blocksDescendants"
    

    and this too

    parent.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
            ((ViewGroup) v).setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
    

提交回复
热议问题