Android gallery of LinearLayouts
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 开发者_如何学Goversion="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>
I've just found out the same question has been asked here: Gallery/AdapterView Child Drawable State
Overriding setPressed did the trick.
精彩评论