ExpandedList视图在android中无法正常工作

ExpandedList视图在android中无法正常工作,android,expandablelistview,Android,Expandablelistview,我在Facebook上通过Json解析获取评论,我创建了扩展列表视图来查看帖子的所有评论,但它不能在版面中扩展。请帮我把这个修好。 这是我的XML布局 <ExpandableListView android:id="@+id/expandableListView1" android:layout_width="match_parent" android:layout_height="wrap_content" android:groupIndica

我在Facebook上通过Json解析获取评论,我创建了扩展列表视图来查看帖子的所有评论,但它不能在版面中扩展。请帮我把这个修好。 这是我的XML布局

 <ExpandableListView
     android:id="@+id/expandableListView1"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:groupIndicator="@null">
 </ExpandableListView>

还有我的密码

public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {

    int s=ConstantsValues.commentsResponse.get(position).size();

    View view=convertView;
    LayoutInflater inflater =(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    view=inflater.inflate(R.layout.custom_expandablecomments_parentgroup, parent,false);
    TextView tv1=(TextView)view.findViewById(R.id.textView_GROUP);
    tv1.setText("Click hee to see " +s+" comments");
    tv1.setPadding(100, 0, 0,0);
    return view;
}
public View getChildView(int groupPosition, int childPosition,boolean isLastChild, View convertView, ViewGroup parent) {

    HashMap<String, Object> hashmap= ConstantsValues.commentsResponse.get(groupPosition).get(childPosition);
    View view=convertView;
    position=childPosition;
    LayoutInflater inflater =(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    view=inflater.inflate(R.layout.custom_expandable_comments, parent,false);
    ImageView imv=(ImageView)view.findViewById(R.id.Imageview_profipic_commentsShow);
    TextView tv1=(TextView)view.findViewById(R.id.textView_Name_CommentShow);
    TextView tv2=(TextView)view.findViewById(R.id.textView_Comments_show);
    imv.setImageBitmap((Bitmap)hashmap.get("Image"));
    tv1.setText((String)hashmap.get("UserName"));
    tv2.setText((String)hashmap.get("CommentsFull"));

    return view;
}
public View getGroupView(int-groupPosition、boolean-isExpanded、View-convertView、View-group-parent){
int s=ConstantsValues.commentsResponse.get(position.size();
视图=转换视图;
LayoutFlater充气器=(LayoutFlater)context.getSystemService(context.LAYOUT\u充气器\u服务);
视图=充气机。充气(R.layout.custom\u expandablecomments\u parentgroup,parent,false);
TextView tv1=(TextView)view.findViewById(R.id.TextView\u组);
tv1.setText(“单击hee查看“+s+”注释”);
tv1.设置填充(100,0,0,0);
返回视图;
}
公共视图getChildView(int-groupPosition、int-childPosition、布尔isLastChild、视图convertView、视图组父级){
HashMap HashMap=ConstantsValues.commentsResponse.get(groupPosition).get(childPosition);
视图=转换视图;
位置=儿童位置;
LayoutFlater充气器=(LayoutFlater)context.getSystemService(context.LAYOUT\u充气器\u服务);
视图=充气机。充气(R.layout.custom\u expandable\u comments,parent,false);
ImageView imv=(ImageView)view.findViewById(R.id.ImageView\u profipic\u commentsShow);
TextView tv1=(TextView)view.findViewById(R.id.TextView\u Name\u CommentShow);
TextView tv2=(TextView)view.findViewById(R.id.TextView\u Comments\u show);
setImageBitmap((Bitmap)hashmap.get(“Image”);
setText((字符串)hashmap.get(“用户名”);
setText((字符串)hashmap.get(“CommentsFull”);
返回视图;
}

使用此代码…希望它能帮助您

@Override
    public void onGroupExpanded(int groupPosition){
        //collapse the old expanded group, if not the same
        //as new group to expand
        if(groupPosition != lastExpandedGroupPosition){
            accordion.collapseGroup(lastExpandedGroupPosition);
        }

        super.onGroupExpanded(groupPosition);           
        lastExpandedGroupPosition = groupPosition;
    }

如果需要默认扩展组,请执行以下操作:

@Override
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
    View v = super.getGroupView(groupPosition, isExpanded, convertView, parent);
    ExpandableListView eLV = (ExpandableListView) parent;
    eLV.expandGroup(groupPosition);
    return v;
}

那就是使用expandGroup发生了什么事..发生了什么事problem@Pragnaniim fetching中的所有注释都没有展开。请检查logcat中是否存在任何异常或错误。.如果是,请发布。.为什么android:groupIndicator=“@null”?@user2230793,即在thatHI for me函数中隐藏箭头标记图标,工作正常,也获得了提要,但用户界面不仅没有获得提要。在我的XML布局中,我已经有了一个FB墙柱的列表视图。在这个布局中,我在下面有一个可展开的列表视图。如果我按parentgroup text,它将不会扩展到show,因为它已经有了注释。@ManojKumar请花一些时间阅读这两个链接,您一定会得到它。。。。和