-1

私はリストビューを持っています。ListView の各行/項目には、 TextViewImageViewの 2 つのビューが含まれています。ImageViewのみが focussable および clickable になり、 textView は focusable および clickable であってはなりません

Eachrow.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"

android:orientation="horizontal" >

<TextView
    android:id="@+id/textViewEachBlockedKeyword"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:text="Keyword"
    android:layout_marginTop="8dp"
    android:layout_marginBottom="8dp"
    android:layout_marginLeft="5dp"
    android:textAppearance="?android:attr/textAppearanceMedium" />

<ImageView
    android:id="@+id/imageViewBlockKeywordDelete"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_weight="3.1"
    android:layout_marginLeft="2dp"
    android:layout_marginTop="8dp"
    android:layout_marginBottom="8dp"


    android:src="@drawable/delete" />

</LinearLayout>

これを行う方法 ?ありがとう

4

3 に答える 3

0

次のようにコードを変更します。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"

android:orientation="horizontal" >

<TextView
    android:id="@+id/textViewEachBlockedKeyword"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:text="Keyword"
    android:layout_marginTop="8dp"
    android:layout_marginBottom="8dp"
    android:layout_marginLeft="5dp"
    android:textAppearance="?android:attr/textAppearanceMedium"
    android:clickable="false"
    android:focusable="false" />

<ImageView
    android:id="@+id/imageViewBlockKeywordDelete"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_weight="3.1"
    android:layout_marginLeft="2dp"
    android:layout_marginTop="8dp"
    android:layout_marginBottom="8dp"
    android:src="@drawable/delete"
    android:clickable="true"
    android:focusable="true" />

</LinearLayout>
于 2013-02-20T09:32:11.827 に答える
0
 android:focusable="false"
   android:focusableInTouchMode="false"
   android:clickable="false"

これをテキストビュータグに追加します

于 2013-02-20T09:33:20.513 に答える
0

以下のコードを試して、imageviewをimagebuttonに変更してください

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"

android:orientation="horizontal" >

<TextView
    android:id="@+id/textViewEachBlockedKeyword"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:text="Keyword"
    android:layout_marginTop="8dp"
    android:layout_marginBottom="8dp"
    android:layout_marginLeft="5dp"
    android:textAppearance="?android:attr/textAppearanceMedium" />

<ImageButton
    android:id="@+id/imageViewBlockKeywordDelete"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_weight="3.1"
    android:layout_marginLeft="2dp"
    android:layout_marginTop="8dp"
    android:layout_marginBottom="8dp"
    android:src="@drawable/delete" />

</LinearLayout>
于 2013-02-20T09:34:05.330 に答える