adroid arrayAdapter重新定义(eclipse提示的)

本文详细解析了Viewcom.example.listviewtest.FruitAdapter.getView方法的工作原理。此方法用于获取ListView中指定位置的数据视图,可以通过手动创建视图或从XML布局文件中加载。当视图加载时,ListView会应用默认的布局参数,除非使用特定的方法指定了根视图并阻止了其附加到根。文章还介绍了该方法的参数和返回值。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

View com.example.listviewtest. FruitAdapter.getView(int position, View convertView, ViewGroup parent)

 

@ Override

 

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 android.view.LayoutInflater.inflate(int, android.view.ViewGroup, boolean) to specify a root view and to prevent attachment to the root.

Overrides: getView(...) in ArrayAdapter

 

Parameters:
position The position of the item within the adapter's data set of the item whose view we want.
convertView The 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. Heterogeneous lists can specify their number of view types, so that this View is always of the right type (see getViewTypeCount() and getItemViewType(int)).
parent The parent that this view will eventually be attached to
Returns:
A View corresponding to the data at the specified position.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值