是否可以在同一个 ArrayList上链接两个或多个适配器?并显示不同的子集
也许我今天有一个奇怪的问题。我现在已经通过使用两个列表“解决”了这个问题,但我只想将信息放在一个列表中,因为我认为它更容易维护和清洁。
假设我们有一个名为
public class PersonsInfo{
int Age;
String Name;
Booelan Female;
}
列表的对象,其中包含所有人员信息
List<PersonsInfo> coolPeople = new ArrayList<PersonsInfo>()
和两个视图,一个 GridView 和一个 ListView
现在我想在 中显示女孩GridView
和 ListView
中的人员。
这可能吗?我必须做什么才能有效?我不再明白了:(
或者我的两个列表的解决方案是唯一的一个?
问候!
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
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.