ListView 能获得列表的ietm吗?

guow043 2010-03-16 05:09:04
比如第一条为“abc”,能得到abc这个字符串吗?
...全文
112 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
CloudyKuang 2010-04-25
  • 打赏
  • 举报
回复
getItem(int position) 这个返回的就是你里面的类型。
vclongking 2010-04-25
  • 打赏
  • 举报
回复
完全可以 自己看看SDK里面的Adapter嘛
guow043 2010-03-18
  • 打赏
  • 举报
回复
谢谢了,现在基本知道怎么实现了
莫名的码农 2010-03-17
  • 打赏
  • 举报
回复
在你的Adapter的getItem(int position)中返回的是什么,然后调getListAdapter().getItem(pos)就会返回什么.
比如:
1 class Content {
2 Bitmap icon;
3 String name;
4 }
5 ...
6 ArrayList<Content> mList = new ArrayList<Content>();//ListView上显示的数据源

7 class MyListAdapter extends BaseAdapter {
8 ...
9 public Object getItem (int pos) {
10 return mList.get(pos);
11 }
12 ...
13 Content c = (Content)getListAdapter.getItem(position);
14 String name = c.name;//这个就是你想要的吧
shmily_yang 2010-03-17
  • 打赏
  • 举报
回复
可以啊,你的adapter是怎么绑定数据的啥??
AspireHouse 2010-03-17
  • 打赏
  • 举报
回复
重写adapter是一个不错的方法
jinlking 2010-03-16
  • 打赏
  • 举报
回复
可以的,看你的adapter是如何绑定的
AspireHouse 2010-03-16
  • 打赏
  • 举报
回复
可以的

80,351

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧