0
私は多くの検索をしていますが、listView内のアイテムは直線レイアウトであり、すでにandroid:descendantFocusable="blockDescendants"
を追加していますが、機能しません。listview、onItemClickListenerは機能しません
私はアダプタでオーバーライドgetView()
と言い、ビューにonCLickListenerを追加すると、それが動作するかどうかはわかりませんが、onItemClickListenerは動作しません。
setOnItemSelectedListenerはうまく動作します。手がかりを得ることはできません。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/item_style"
android:focusable="true"
android:descendantFocusability="blocksDescendants">
<ImageView
android:id="@+id/dialog_item_type"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:paddingLeft="5dp"
android:focusable="false"
/>
<TextView android:layout_weight="1"
android:id="@+id/dialog_item_name"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp"
android:textStyle="bold"
android:textColor="#FFFFFFFF"
/>
<ImageView
android:id="@+id/dialog_item_sel"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:paddingRight="5dp"
/>
private class FileListView extends ListView{
private List<Map<String, Object>> tempShowList ;
public FileListView(Context context) {
super(context);
this.setSelector(R.drawable.item_unfocus);
this.setItemsCanFocus(true);
this.setClickable(true);
this.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> adapterView, View arg1,
int position, long arg3) {
Log.e("on item click","here");
}
}
}
あなたはbeforeDescendantsを試しましたか? –
あなたはandroid:descendantFocusability = beforeDescendantsと言っていますか?これを設定しないでください。私は無駄に何かを設定しようとしなかった。 @Yashwanth Kumar – zyunchen
私はbeforeDescendants.in無駄に試してみました。 – zyunchen