How to add image in expandablelistivew?

后端 未结 2 1116
孤独总比滥情好
孤独总比滥情好 2020-12-22 03:20

I am using expandablelistview in my project,and I want to add different images for group view and also in child view I want to do same,but its not working,following is my co

2条回答
  •  轮回少年
    2020-12-22 03:42

    You are trying to convert String to Integer

    In your

    ExpandableTests class
    

    comment following lines

    //in getChildView() method
       // final int childimg = (Integer) getChild(groupPosition, childPosition);
    
    //in getGroupView method
    //String headerTitle = (String) getGroup(groupPosition);
    

    And use any default icon for following images like

    imgsListHeader.setImageResource(R.drawable.ic_launcher);
    imgListChild.setImageResource(R.drawable.ic_launcher);
    

    By this way you will get out of crash and hope you will get idea further image displaying.

提交回复
热议问题