打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Adapter中的getView方法

 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。
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
Android ListView中item view重复使用带来的问题
当ListView有Header时,onItemClick里的position不正确
FragmentTabHost切换Fragment时避免UI重新加载
ListView的优化
关于如何提高ListView的滚动速度的问题
按照预期初始化布局--layout inflation as intended
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服