我正在使用包含 2 个不同子项的可扩展 ListView。子布局包含 3 个 EditText 字段。当我展开组时,它会显示子布局,但我无法在 edittext 字段中键入任何文本。
我在自定义可扩展列表适配器中的代码如下:
public View getChildView(int groupPosition, int childPosition, boolean arg2, View childView,
ViewGroup parent)
{
switch (groupPosition)
{
case 0:
childView = inflater.inflate(R.layout.edit_personal_layout, null);
final EditText fname = (EditText)childView.findViewById(R.id.editTextFname);
fname.setOnClickListener(new OnClickListener() {
public void onClick(View arg0)
{
// TODO Auto-generated method stub
fname.setFocusable(true);
}
});
break;
case 1:
childView = inflater.inflate(R.layout.edit_experience_layout, null);
break;
case 2:
childView = inflater.inflate(R.layout.edit_qualification_layout, null);
break;
case 3:
childView = inflater.inflate(R.layout.edit_login_layout, null);
break;
case 4:
childView = inflater.inflate(R.layout.edit_other_layout, null);
break;
}
return childView;
}
public View getGroupView(int position, boolean arg1, View view, ViewGroup parent)
{
if(view==null)
{
view = inflater.inflate(R.layout.edit_head, null);
}
TextView head = (TextView)view.findViewById(R.id.list_item_text_view_head);
head.setText(menu[position]);
return view;
}