无法响应点击事件OnItemClickListener
android:descendantFocusability="blocksDescendants"即可。这样Item Layout就屏蔽了所有子控件获取Focus的权限,
beforeDescendants:viewgroup会优先其子类控件而获取到焦点
afterDescendants:viewgroup只有当其子类控件不需要获取焦点时才获取焦点
blocksDescendants:viewgroup会覆盖子类控件而直接获得焦点
android lietView 自定义布局文件 含CheckBox 点击Item 勾选CheckBox
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
if(favoriteDeleteRela.getVisibility() == View.VISIBLE){
FavoriteVideoListItem item = (FavoriteVideoListItem)favoriteAdapter.getItem(position);
if (4<3) {
Intent intent = new Intent(Activity1.this,Activity2.class);
startActivity(intent);
}else {
LinearLayout view1 =(LinearLayout)view;
LinearLayout view2 =(LinearLayout) view1.getChildAt(0);
CheckBox box =(CheckBox) view2.getChildAt(2);
box.setChecked(!box.isChecked());
}
}
});
a
http://blog.sina.com.cn/s/blog_6fff321b0100owiw.html