谢谢
public VIEw getChildVIEw(int p_ID,int c_ID,boolean bln1,VIEw vIEw,VIEwGroup vIEwgroup) { // Todo auto-generated method stub if (vIEw == null) { vIEw = inflater.inflate(com.example.eventlive.R.layout.homescreen_List_item_child,vIEwgroup,false); } TextVIEw textVIEw = (TextVIEw) vIEw.findVIEwByID(R.ID.List_item_text_child); //"i" is the position of the parent/group in the List and //"i1" is the position of the child textVIEw.setText(mParent.get(p_ID).getArrayChildren().get(c_ID)); vIEw.setBackgroundResource(R.drawable.child_bg); //return the entire vIEw return vIEw;}//counts the number of children items so the List kNows how many times calls getChildVIEw() method@OverrIDepublic int getChildrenCount(int p_ID) { // Todo auto-generated method stub return mParent.get(p_ID).getArrayChildren().size();}解决方法 只需初始化一个空的子数组,如下所示:
private HashMap<String,ArrayList<String>> mGroupsItems = new HashMap<String,ArrayList<String>>();. . .mGroupsItems.put(name_of_empty_group,new ArrayList<String>());总结
以上是内存溢出为你收集整理的android – 可扩展的listview没有孩子全部内容,希望文章能够帮你解决android – 可扩展的listview没有孩子所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)