如何在 ListView 中的项目旁边添加 ImageView?
我正在尝试为食物制作食谱 ListView,并且我想在列表中的项目旁边添加 imageView。我怎样才能做到这一点?谢谢。
I am trying to make a recipe ListView for food and I want to add imageViews next to items in my list. How can i do that? Thx.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
遵循本教程对您来说可能是一个好主意(主要是第二个示例)。
http://www.mkyong.com/android/android-listview-example/
但无论如何,在问这样一个基本问题之前,你应该先谷歌一下。
Following this tutorial could be a nice idea for you (mainly the second example).
http://www.mkyong.com/android/android-listview-example/
But anyway, you should Google a little bit before asking such a basic question.
ListView 项目可以有自己的自定义布局。
您必须为 ListView 创建适配器。创建适配器时,您可以分配自定义布局。
注意:您必须实现 getView() 来设置图像+文本的属性。
这里有一个示例: ListView 中图片的延迟加载
A ListView item can have it's own custom layout.
You have to create your adapter for the ListView. When you create your adapter you can assign your custom layout.
Note: You will have to implement getView() to property set the image+text.
Here you have a sample: Lazy load of images in ListView