1

I'm using Gallery widget to create gallery of LinearLayouts, each of them containing a button. The problem is that while scrolling or clicking LinearLayout that button gets "pressed" state. How do I prevent it? I want it to react only to direct button clicks.

Thanks

// Edit: attached code

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="260dip"
    android:layout_height="wrap_content"
    android:padding="10dip">

  <!-- some other things here -->

  <Button style="@style/button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:text="Just testing" />
</LinearLayout>
Sebastian Nowak
  • 5,607
  • 8
  • 67
  • 107

1 Answers1

2

I've just found out the same question has been asked here: Gallery/AdapterView Child Drawable State

Overriding setPressed did the trick.

Community
  • 1
  • 1
Sebastian Nowak
  • 5,607
  • 8
  • 67
  • 107