Adapter中的getView方法

public abstract View getView (int position, View convertView, ViewGroup parent)
引入自: API 级别1

Get a View that displays the data at the specified position in the data set. You can either create a View manually or inflate it from an XML layout file. When the View is inflated, the parent View (GridView, ListView...) will apply default layout parameters unless you use inflate(int, android.view.ViewGroup, boolean) to specify a root view and to prevent attachment to the root.


获得一个View,这个View显示了在数据集中指定位置的数据,你既可以用手工创建一个View也可以把它从一个XML布局文件中inflate出来。当这个View被Inflate后,其父View(GridView,ListView...)会设置一个默认的参数除非你用inflate(int, android.view.ViewGroup, boolean)方法去指定一个根View并且去阻止附加到其根上。

参数
position要从适配器中取得的视图的位置.
convertViewThe old view to reuse, if possible. Note: You should check that this view is non-null and of an appropriate type before using. If it is not possible to convert this view to display the correct data, this method can create a new view.
如果可能的话,这是被重用的老的View。
parent
The parent that this view will eventually be attached to
最终被附加到的父View
返回值
  • A View corresponding to the data at the specified position.
  • 返回一个对应于指定位置的View。
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值