I have a simple LinearLayout(horizontal) with 3 TextViews. The background 
of these TextViews are set to a drawable that has two states, state_pressed and 
default. I simply change the background of each TextView to red on 
state_pressed.
But when i click one TextView, its click listener is invoked but background 
of all 3 changes to red. This is happening on Android 2.x and working fine 
on Android 4.0+.

<LinearLayout
        android:id="@+id/back"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="horizontal"
        android:paddingLeft="@dimen/swipe_list_leftoffest"
        android:descendantFocusability="blocksDescendants"
        android:background="@color/list_swipe_back"
        android:clickable="false"
        android:focusable="false"
        android:focusableInTouchMode="false"
        android:weightSum="3"
        android:tag="back">


                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textSize="14sp"
                    android:clickable="true"
                    android:layout_weight="1"
                    android:gravity="center"
                    android:id="@+id/amenities_view"
                    android:padding="@dimen/padding_large"
                    android:background="@drawable/swipe_view_background"
                    android:drawablePadding="@dimen/padding_large"
                    android:textColor="@color/white"
                    android:text="@string/amenities_text"
                    android:drawableTop="@drawable/ic_amenities"
                    />


            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="14sp"
                android:layout_weight="1"
                android:clickable="true"
                android:gravity="center"
                android:ellipsize="end"
                android:singleLine="true"
                android:id="@+id/cancpolicy_view"
                android:padding="@dimen/padding_large"
                android:background="@drawable/swipe_view_background"
                android:drawablePadding="@dimen/padding_large"
                android:textColor="@color/white"
                android:text="@string/canc_policy_text"
                android:drawableTop="@drawable/ic_cancellation_policy"

                />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="14sp"
                android:layout_weight="1"
                android:gravity="center"
                android:clickable="true"
                android:padding="@dimen/padding_large"
                android:id="@+id/reviews_view"
                android:background="@drawable/swipe_view_background"
                android:drawablePadding="@dimen/padding_large"
                android:textColor="@color/white"
                android:text="@string/reviews_text"
                android:drawableTop="@drawable/ic_reviews"
                />


    </LinearLayout>

Tried putting focusable and focusableInTouchMode false for each of the 
TextViews, but that didnt help.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to