我在listItemClick上的列表项内部放大视图。列表项包含一个复选框。单击复选框时,包含两个/三个编辑文本字段和按钮的线性布局会被充气到该列表视图(通过游标适配器的getView方法完成,动态创建充气视图)。在列表视图中插入单个视图使listItem不可点击
列表视图在项目点击监听器上注册。在布局被充气后,onItemClick监听器不会被调用特定的项目。帮我
我getView代码
TextView text1 = (TextView) view.findViewById (R.id.text);
text1.setText("text");
CheckBox cb = (CheckBox)view.findViewById(R.id.checkBoxList) ;
cb.setTag(tag);
cb.setChecked(false);
if (chekedIdVector.contains(cursor.getString(cursor.getColumnIndex(ID))))
{
cb.setChecked(true);
}
if(!idVector.isEmpty())
{
LinearLayout ll =(LinearLayout)view.findViewById(R.id.layoutinCell);
if (((String)idVector.lastElement()).equals(cursor.getString(cursor.getColumnIndex(_ID))))
{
if (ll.getChildCount() == 0)
{
ll.removeAllViews() ;
ll.addView(dynamicallyCreatedView); // view dynamically created with 2/3 textviews and buttons
}
ll.setVisibility(View.VISIBLE);
view.requestFocus() ;
}
else
{
ll.removeAllViews() ;
}
}
return view ;
PS:我已经在专注试图改变监听器,并设置复选框以非可聚焦在XML
请检查此[post](http://meta.stackexchange.com/a/5235/176658) – nandeesh
什么是'view'?你如何在'view'里搜索'LinearLayout',然后添加'view'作为这个'LinearLayout'的子节点? 'view'不能同时是'll'的父母和孩子。 – user113215
@ user113215该视图是游标适配器中getView()方法的参数。子视图是个动态创建视图。我已编辑它:-) – arul