android setOnItemClickListener 不起作用
当item中拥有Checkbox控件时候, setOnItemClick 不起作用
解决办法:
- 父控件添加属性: android:descendantFocusability="blocksDescendants"
- 子控件添加属性: android:focusable="false"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/widget_size_166"
android:layout_marginLeft="@dimen/widget_size_8"
android:layout_marginTop="@dimen/widget_size_8"
android:layout_marginRight="@dimen/widget_size_8"
android:background="@drawable/plan_shape"
android:descendantFocusability="blocksDescendants"
android:orientation="vertical">
<CheckBox
android:id="@+id/switch_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="@dimen/widget_size_10"
android:button="@drawable/checkbox_alarm_selector"
android:checked="false"
android:focusable="false" />
</LinearLayout>
完成仿微信录音的交互功能的开发
决通用加载页面与下拉刷新控件冲突,导致下拉刷新动画执行不完整的问题
GONE 会导致布局重新执行layout函数,INVISIBLE 不会
当Android列表项中包含Checkbox时,setOnItemClickListener可能无法正常工作。通过给父控件添加android:descendantFocusability=blocksDescendants和将Checkbox的android:focusable设为false,可以解决这个问题。此外,文章还提到了创建通用的Loading页面,实现微信录音交互功能,处理滑动与父控件的冲突,以及解决加载页面与下拉刷新控件的冲突问题。
7174

被折叠的 条评论
为什么被折叠?



