Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/204.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
expandablelistview android中键的排序_Android_Expandablelistview - Fatal编程技术网

expandablelistview android中键的排序

expandablelistview android中键的排序,android,expandablelistview,Android,Expandablelistview,我正在创建一个hashmap,并按照我希望在可扩展listview中显示的顺序在其中添加键。下面是将字符串放入hashmap的代码: HashMap<String, List<String>> example= new HashMap<String, List<String>>(); example.put(cnt.getString(R.string.first), first_summary); example.

我正在创建一个hashmap,并按照我希望在可扩展listview中显示的顺序在其中添加键。下面是将字符串放入hashmap的代码:

HashMap<String, List<String>> example= new HashMap<String, List<String>>();
        example.put(cnt.getString(R.string.first), first_summary);
        example.put(cnt.getString(R.string.second), second_summary);
        example.put(cnt.getString(R.string.third), third_summary);

你能给我引路吗?。

这不是
ExpandableListView
的错。
HashMap
没有顺序的概念。试着用一种新的方法。从医生那里

LinkedHashMap是保证迭代的Map的实现 秩序。支持所有可选操作


这不是
ExpandableListView
的错。
HashMap
没有顺序的概念。试着用一种新的方法。从医生那里

LinkedHashMap是保证迭代的Map的实现 秩序。支持所有可选操作


您需要将
HashMap
替换为
LinkedHashMap

在代码中替换

HashMap示例=新建HashMap()


LinkedHashMap示例=新建LinkedHashMap()

您需要将
HashMap
替换为
LinkedHashMap

在代码中替换

HashMap示例=新建HashMap()

LinkedHashMap示例=新建LinkedHashMap()

 public View getGroupView(int parent, boolean isExpanded, View convertview, ViewGroup parentview) {
    // TODO Auto-generated method stub
    String group_title = (String) getGroup(parent);
    if(convertview == null)
    {
        LayoutInflater inflator = (LayoutInflater) ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        convertview = inflator.inflate(R.layout.parent_layout, parentview,false);
    }
    TextView parent_textview = (TextView) convertview.findViewById(R.id.parent_txt);
    parent_textview.setTypeface(null, Typeface.BOLD);
    parent_textview.setText(group_title);
    return convertview;
}