setOnItemClickListener自定义的ListView [英] setOnItemClickListener on custom ListView

查看:344
本文介绍了setOnItemClickListener自定义的ListView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个自定义的ListView。这ListView控件包含1图像和6的TextView,检索值我已创建一个setOnItemClickListener。每当我点击的ListView我怎么可能实际上是从6 TextView的检索所有的数据?

I have a custom ListView. This ListView contain of 1 Image and 6 TextView,to retrieve the value I have create a setOnItemClickListener. Whenever I click on the ListView how could I actually retrieve all the data from the 6 TextView?

推荐答案

样品code:

ListView list = (ListView) findViewById(R.id.listview);
list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
   @Override
   public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
      Object listItem = list.getItemAtPosition(position);
   } 
});

在样品code以上,ListItem中应包含所选择的数据TextView的。

In the sample code above, the listItem should contain the selected data for the textView.

这篇关于setOnItemClickListener自定义的ListView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆