Android线性布局画廊

Android线性布局画廊,android,button,gallery,android-linearlayout,Android,Button,Gallery,Android Linearlayout,我正在使用Gallery小部件创建LinearLayouts的Gallery,每个都包含一个按钮。问题是滚动或单击线性布局时,该按钮处于“按下”状态。我如何预防它?我希望它只对直接点击按钮做出反应 谢谢 //编辑:附加代码 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orien

我正在使用Gallery小部件创建LinearLayouts的Gallery,每个都包含一个按钮。问题是滚动或单击线性布局时,该按钮处于“按下”状态。我如何预防它?我希望它只对直接点击按钮做出反应

谢谢

//编辑:附加代码

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

我刚刚发现这里也有人问过同样的问题:


覆盖setPressed成功了。

您能发布布局代码吗?您可以尝试将LinearLayouts设置为android:clickable=“false”我已经包含了代码。安卓:clickable没有帮助,但无论如何,谢谢你,这可能是有意的行为。如果这真的让你感到困扰,你可以尝试使用一个手势监听器来让GalleryView按照你想要的方式运行。这绝对是android开发者想要的行为,否则它就无法正常工作。我想问的是如何禁用它。除非您检测到希望它做出反应的运动事件,否则请将所有按钮设置为clickable=“false”?