我不能让ListView的项目 [英] I can not get the items of a listview
本文介绍了我不能让ListView的项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有两个TextView的在我的hola.xml文件,我想说明的是第一个(0)。谢谢
TextView的T =(TextView中)findViewById(R.id.textViewNMAT1);
字符串富=((TextView中)((ViewGroup中)ARG1).getChildAt(0))的getText()的toString()。
t.setText(富);
解决方案
更改为
@覆盖
公共无效onItemClick(适配器视图<> infoM,查看ARG1,INT职位,长_id)
{
TextView的T =(TextView中)findViewById(R.id.textViewNMAT1);
字符串富=((TextView中)ARG1).getText()的toString()。
t.setText(富);
}
第一个参数
是保存适配器
信息对象(微调
,的ListView
,等...),第二个参数
是查看
这是点击(这里的TextView
)。因此,获得这是在文本的TextView
。
I have two textview in my hola.xml file, I want to show is the first (0). thanks
TextView t = (TextView) findViewById(R.id.textViewNMAT1);
String foo = ((TextView)((ViewGroup) arg1).getChildAt(0)).getText().toString();
t.setText(foo);
解决方案
Change to
@Override
public void onItemClick(AdapterView<?> infoM, View arg1, int posicion, long _id)
{
TextView t = (TextView) findViewById(R.id.textViewNMAT1);
String foo = ((TextView)arg1).getText().toString();
t.setText(foo);
}
the first param
is the object that holds the Adapter
info (Spinner
, ListView
, etc...) and the second param
is the View
which was clicked (here a TextView
). So get the text which is in that TextView
.
这篇关于我不能让ListView的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文