gpt4 book ai didi

java - 如何将 expandablelistview 的默认扩展限制设置为 4?

转载 作者:太空狗 更新时间:2023-10-29 14:04:24 27 4
gpt4 key购买 nike

我正在使用 expandablelistview。默认情况下,我必须将组 ListView 扩展到 4。有可能实现吗?

最佳答案

您可以在组 ListView 中定义固定值,如下所示:

private void prepareListData() {
listDataHeader = new ArrayList<String>();
listDataChild = new HashMap<String, List<String>>();

// Adding parent data
listDataHeader.add("first");
listDataHeader.add("second");
listDataHeader.add("third");
listDataHeader.add("fourth");

// Adding child data
List<String> first = new ArrayList<String>();
first.add("The Shawshank Redemption");
first.add("The Godfather");
first.add("The Godfather: Part II");
first.add("Pulp Fiction");
first.add("The Good, the Bad and the Ugly");
first.add("The Dark Knight");
first.add("12 Angry Men");

List<String> second = new ArrayList<String>();
second.add("The Conjuring");
second.add("Despicable Me 2");
second.add("Turbo");
second.add("Grown Ups 2");
second.add("Red 2");
second.add("The Wolverine");

List<String> third = new ArrayList<String>();
third.add("2 Guns");
third.add("The Smurfs 2");
third.add("The Spectacular Now");
third.add("The Canyons");
third.add("Europa Report");

listDataChild.put(listDataHeader.get(0), first); // Header, Child data
listDataChild.put(listDataHeader.get(1), second);
listDataChild.put(listDataHeader.get(2), third);
}

关于java - 如何将 expandablelistview 的默认扩展限制设置为 4?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33522122/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com