片段中的Android ListView [英] Android ListView in Fragment

查看:30
本文介绍了片段中的Android ListView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个项目列表,其中包含一个图像和每个人对图像的一些描述.之后,该列表将被放置在应用程序内的 fragment 中.谁能指导我创建它?我不太确定没有 ListActivity 怎么办.

I am trying to create a list of items which contains an image and some description for the image in each individual. After which, the list will be place in a fragment inside the application. Can anyone guide me to create it? I am not too sure how can I do it without the ListActivity.

推荐答案

看起来你的 Fragment 应该子类化 ListFragment(不是 ListActivity).ListFragment 中的 onCreateView() 将返回一个 ListView 然后你就可以填充了.

It seems like your Fragment should subclass ListFragment (not ListActivity). onCreateView() from ListFragment will return a ListView you can then populate.

以下是开发者指南中关于填充列表的更多信息:你好,ListView

Here's more information on populating lists from the developer guide: Hello, ListView

这篇关于片段中的Android ListView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆