public class ExpAdapter extends BaseExpandableListAdapter {
private Context myContext;
public ExpAdapter(Context context) {
myContext = context;
}
public Object getChild(int groupPosition, int childPosition) {
return null;
}
public long getChildId(int groupPosition, int childPosition) {
return 0;
}
public View getChildView(int groupPosition, int childPosition,
boolean isLastChild, View convertView, ViewGroup parent) {
if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) myContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.mainscreenadvandprochlidrow, null);
}
我使用了BaseExpandableListAdapter
的自定义可扩展列表视图为该组添加了一个编辑文本,并且有一些子节点...现在,当我点击组指示符时..它不会随其子节点展开...如果我从组中删除编辑ext,则会扩展...现在我做了编辑文本焦点能力部分错误...列表视图扩展,直到我点击编辑文本...什么是首选解决方案??
答案 0 :(得分:0)
在您的活动中:
expandlist.setPressed(假); (expandlist是您的自定义可扩展列表视图)
ExpAdapter expAdapter = new ExpAdapter(context);
expAdapter.ExpandableListView(expandlist);
,添加如下:
public class ExpAdapter extends BaseExpandableListAdapter {
private ExpandableListView expandlist; private ExpandableListView expandlist;
public void setExpandableListView(ExpandableListView expandlist){
this.expandlist = expandlist;
}
@Override
public View getGroupView(final int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {convertView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(!isExpanded){
expandlist.collapseGroup(groupPosition)
}else{
expandlist.expandGroup(groupPosition);
}
}
});
return convertView; }