我想在Android中显示一个列表(I want to display a list in Android)

编程入门 行业动态 更新时间:2024-10-20 00:39:37
我想在Android中显示一个列表(I want to display a list in Android)

我想在Android中创建一个任务列表。 所以,我创建了一个名为Task的类,这个类有一些属性(Name,Date,description)。 我也创建了一个TaskList,这个列表扩展了TreeSet。

我想在Android中显示此列表,我不知道如何。 将来我希望当用户点击任务时,他可以更改属性。

什么是正确的? 为任务创建片段? 使用ListAdapter作为任务列表? 什么是最好的方法? 请给我正确的方法来实现这一点,我将搜索代码

我希望看起来像:

................

任务1

去上大学

日期:07/04/2016

................

任务2

买水

日期:2016年4月8日

...............

任务3

读一本书

日期:2016年4月9日

...............

谢谢!

I want to create a list of tasks in Android. So, i have created a Class named Task, this class have this some properties (Name, Date, description). And I have created a TaskList too, this list extends TreeSet.

I want to show this list in Android, and I don't know how. In the future I want that when the user click on the task, he can change the properties.

What is correct to do? Create a Fragment for Task? Use ListAdapter for the List of Tasks? What is the best way? Please give me the right way to implement this and I will search to code it

I wish that looks like:

................

Task 1

Go to college

Date: 07/04/2016

................

Task 2

Buy a water

Date: 08/04/2016

...............

Task 3

Read a book

Date: 09/04/2016

...............

Thanks!

最满意答案

使用Recyclerview。 它比ListView更好,并在添加和删除项目时提供默认动画。 这里有一个完整的例子

Use Recyclerview. It's better than ListView and provides default animations while adding and removing items. A complete example can be found here

更多推荐

本文发布于:2023-08-02 18:34:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1379630.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:我想   列表   list   Android   display

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!