ListView和ListItem中的CheckBox点击冲突的问题

               
 
  
  1. <CheckBox    
  2.         android:id="@+id/cb"    
  3.         android:layout_width="wrap_content"    
  4.         android:layout_height="wrap_content"    
  5.         android:focusable="false"    
  6.         android:focusableInTouchMode="false"    
  7.         android:clickable="false"           
  8.         android:checkMark="?android:attr/listChoiceIndicatorMultiple"/>    
 
  
  1. android:focusable="false"   
  2.         android:focusableInTouchMode="false"   
  3.         android:clickable="false"   

这三句很重要,如果不加就会出现错误。

由于checkbox的点击事件优先级比listview的高,所以要在checkbox中添加android:focusable="false",使得checkbox初始的时候没有获取焦点。


           

再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.csdn.net/jiangjunshow

猜你喜欢

转载自blog.csdn.net/gfdhjf/article/details/86518728