如何正确从 ListAdapter 获取视图?

发布于 2024-12-12 06:10:24 字数 212 浏览 2 评论 0原文

如何正确使用ListAdapter.getView(intposition,ViewconvertView,ViewGroupparent)方法? 我无法找出 ViewGroup 的期望。

从我得到的信息:

  • position是我想要的元素编号
  • convertView是我为布局中的项目定义的视图
  • parent =?

How do I properly use ListAdapter.getView(int position, View convertView, ViewGroup parent) method?
I'm having trouble finding out what the ViewGroup expect.

From what I get:

  • position is the element number that i want
  • convertView is the View that I defined for the items in my layout
  • parent = ?

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

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

发布评论

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

评论(1

栀梦 2024-12-19 06:10:24

父级是 ListView(或其他类型的 ViewGroup),其数据由 ListAdapter 提供。

注意:您不应该直接调用此方法。它是一个 Adapter 接口方法,您通常在自己的 BaseAdapter 子类中重写,以便您完全控制列表中每个项目的视图显示方式。

parent is the ListView (or other type of ViewGroup) whose data is being supplied by the ListAdapter.

Note: You shouldn't really be calling this method directly. It is an Adapter interface method you typically override in your own BaseAdapter subclass to give you complete control over how the views are displayed for each item in the list.

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