我有一个ListView的内容为假设android在第一行,黑莓在第二行和iPhone在第三行所以现在我想让ListView的整行可点击,但是当我点击上面列表视图行的内容,那么它执行只有点击事件,但我想如果我点击行中的任意地方,然后点击动作要制作列表视图点击performed.My代码如下:在XML如何在列表视图中使全行可点击android
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.listartistspacedetailview);
setListAdapter(new ArrayAdapter(this,R.layout.listitem_layout,R.id.barrio, keywordxmlparsing.array_artistname));
}
@Override
protected void onListItemClick(ListView l, View v, int position, long thisID)
{
Intent i = new Intent(Artistspacedetailview.this, Loadingimagetab.class);
startActivity(i);
}
和ListView标签文件是:
<ListView
android:clickable="true"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:id="@+id/android:list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_below="@id/horizontolline"
android:cacheColorHint="#00000000"
android:drawSelectorOnTop="false" />
你的问题还不清楚。点击一个listitem可能应该选择raw(应该捕获它的点击事件)。不清楚你有什么问题! – Hiral 2011-12-28 11:33:01
请发布listitem_layout。 – Ian 2011-12-28 11:39:02
我的意思是,当我点击列表iten在一行然后只列表行是可点击其他明智的点击事件不fire.even我定义android:clickable =“true”,并使列表视图的宽度填充父。 – shyam 2011-12-29 04:28:47