我有一個自定義的listview
包含一些。餘設置的列表視圖的adapter
如下:如何使listview的textview可點擊
BestandTypAdapter bestandTypAdapter = new BestandTypAdapter(getActivity(), R.layout.bestand_type_liste, dataList);
li.setAdapter(bestandTypAdapter);
並且如bestand_type_liste佈局的代碼顯示在下面的TextView的是可點擊
bestand_type_liste:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/layout_depots_typ"
android:padding="5dip" >
<TableRow
android:paddingRight="10dip"
android:paddingLeft="10dip"
>
<TextView
android:id="@+id/BESTAND_TYP_NAME"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_weight="0.50"
android:clickable="true"/> <<=================
在getView()
方法adapter
我正在使用onClickListener
與名稱TexView
相關聯,這樣當名稱被點擊時位置如下的logCat
顯示:
holder.name.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.i("", "position_ : " + pos);
}
});
的問題是,當我在listview
項目沒有點擊出現,如何解決這個問題
你並不需要設置'機器人:點擊= 「true」到'textView'。 –
只是一個問題:爲什麼「holder.name.set ...」而不是「myTextView.set ...」? –