0

My first question here! I need some help with clicking through my TextViews. They are inserted into a TableRow that is dynamically added to a TableLayout. They take up almost all the space (minus the padding) of the TableRows and because of that I can't make it so the TableRows ClickListener registers the click instead of the TextViews. Only if I click the edges of the rows (again, the padding) does it work.

Here's the XML for the row that is to be inserted into a predefined TableLayout and contains the textviews that I need to click through.

<?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>

I've been searching for solutions and the only ones I found said to set all those "clickable"- and focusable-attributes to false, but none of that worked.

There really should be a simple solution to this, right!?

1 Answers1

0

try this

<?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:descendantFocusability="blocksDescendants" >

<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>
Kaushik
  • 6,150
  • 5
  • 39
  • 54
  • Nope, this did not help :( I tried "beforeDescendants" and "afterDescendants" too, but neither worked. How strange that such a thing could be so complicated. – DunderKlumpen Dec 04 '13 at 13:43