是否可以在同一个 ArrayList上链接两个或多个适配器?并显示不同的子集

发布于 2024-12-21 11:15:40 字数 492 浏览 2 评论 0原文

也许我今天有一个奇怪的问题。我现在已经通过使用两个列表“解决”了这个问题,但我只想将信息放在一个列表中,因为我认为它更容易维护和清洁。

假设我们有一个名为

public class PersonsInfo{
int Age;
String Name;
Booelan Female;
}

列表的对象,其中包含所有人员信息

List<PersonsInfo> coolPeople = new ArrayList<PersonsInfo>()

和两个视图,一个 GridView 和一个 ListView

现在我想在 中显示女孩GridViewListView 中的人员。

这可能吗?我必须做什么才能有效?我不再明白了:(

或者我的两个列表的解决方案是唯一的一个?

问候!

maybe I have a strange question today. I already "solved" this at the moment by using two lists, but I want the infos in only one list, because i think it is easier to maintain and cleaner.

Lets assume that we have an object called

public class PersonsInfo{
int Age;
String Name;
Booelan Female;
}

a list holding all the peoples info

List<PersonsInfo> coolPeople = new ArrayList<PersonsInfo>()

and two Views, a GridView and a ListView

Now I want to show the girls in the GridView and the guys in the ListView.

Is this possible and what do i have to do, that this works? I don't get it anymore :(

Or is my solution with two lists the only one?

Greetings!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

温柔戏命师 2024-12-28 11:15:40

java 中没有等效的 LINQ,但您需要查看 Quaere 此处
这将允许您根据班级中的 boolean 属性过滤女孩/男孩。

There isn't a LINQ equivalent in java, but you will need to look at Quaere here
This will allow you to filter girls / boys based on the boolean property you have in your class.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文