ここで私の最初の質問!TextView をクリックする際に助けが必要です。これらは、TableLayout に動的に追加される TableRow に挿入されます。それらは TableRows のほぼすべてのスペース (パディングを除く) を占有するため、作成できないため、TableRows ClickListener は TextViews の代わりにクリックを登録します。行の端 (再びパディング) をクリックした場合にのみ機能します。
以下は、定義済みの TableLayout に挿入される行の XML で、クリックする必要があるテキストビューが含まれています。
<?xml version="1.0" encoding="utf-8"?>
<TableRow xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/cell_shape"
android:padding="5dp"
android:clickable="true"
>
<TextView
android:id="@+id/contactId"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:clickable="false"
android:longClickable="false"
android:linksClickable="false"
android:focusable="false"
android:focusableInTouchMode="false" />
<TextView
android:id="@+id/contactEntryLastName"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/black"
android:textIsSelectable="true"
android:background="@android:color/transparent"
android:clickable="false"
android:longClickable="false"
android:linksClickable="false"
android:focusable="false"
android:focusableInTouchMode="false" />
<TextView
android:id="@+id/contactEntryFirstName"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/black"
android:textIsSelectable="true"
android:background="@android:color/transparent"
android:clickable="false"
android:longClickable="false"
android:linksClickable="false"
android:focusable="false"
android:focusableInTouchMode="false" />
</TableRow>
私は解決策を探していましたが、「クリック可能」属性とフォーカス可能属性をすべて false に設定するという唯一の解決策を見つけましたが、どれも機能しませんでした。
これには本当に簡単な解決策があるはずですよね!?