ExpandableListView array lists won't stay in the order I put them
本问题已经有最佳答案,请猛点这里访问。
我正在使用ExpandableListView,我在数组列表中设置了一些列表。
我将它们设置为某个顺序,即:
1 | company, day of the week, posh vehicles, topgear vehicles |
但是我做了什么,订单还原
1 | posh vehicles, company, days of the week, topgear vehicles |
任何人都可以帮我解决这里的问题是我用于stringArray的代码吗?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | public static HashMap<String, List<String>> getData() { HashMap<String, List<String>> expandableListDetail = new HashMap<String, List<String>>(); List<String> listDataHeader = new ArrayList<String>(); // Adding child data listDataHeader.add("Company"); listDataHeader.add("Please pick a day"); listDataHeader.add("Posh Vehicles"); listDataHeader.add("TopGear Vehicles"); List<String> CompanyName = new ArrayList<>(); CompanyName.add("Posh limos"); CompanyName.add("TopGear limos"); List<String> daysOftheWeek = new ArrayList<>(); daysOftheWeek.add("Monday"); daysOftheWeek.add("Tuesday"); daysOftheWeek.add("Wednesday"); daysOftheWeek.add("Thursday"); daysOftheWeek.add("Thursday"); daysOftheWeek.add("Friday"); daysOftheWeek.add("Saturday"); daysOftheWeek.add("Sunday"); List<String> poshvehicles = new ArrayList<>(); poshvehicles.add("Posh H2 limo"); poshvehicles.add("Iveco party bus"); poshvehicles.add("Merc party bus"); poshvehicles.add("Party coach"); List<String> topGearVehicles = new ArrayList<>(); topGearVehicles.add("TopGear H2 limo"); topGearVehicles.add("TopGear party bus"); expandableListDetail.put(listDataHeader.get(0),CompanyName); expandableListDetail.put(listDataHeader.get(1),daysOftheWeek); expandableListDetail.put(listDataHeader.get(2),poshvehicles); expandableListDetail.put(listDataHeader.get(3),topGearVehicles); return expandableListDetail; |
您可以使用
1 |
我还使用了左侧