Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/229.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 滑动抽屉内容触摸不工作_Android_Android Layout_Android View - Fatal编程技术网

Android 滑动抽屉内容触摸不工作

Android 滑动抽屉内容触摸不工作,android,android-layout,android-view,Android,Android Layout,Android View,我在活动中使用滑动抽屉进行一些互动 <SlidingDrawer android:id="@+id/sdDrawerLeft" android:layout_width="80dp" android:layout_height="match_parent" android:layout_gravity="left" android:content="@+id/sdLeftContent" and

我在活动中使用滑动抽屉进行一些互动

<SlidingDrawer
        android:id="@+id/sdDrawerLeft"
        android:layout_width="80dp"
        android:layout_height="match_parent"
        android:layout_gravity="left"
        android:content="@+id/sdLeftContent"
        android:handle="@+id/sdLeftHandle"
        android:orientation="horizontal"
        android:rotation="180" >

        <ImageView
            android:id="@+id/sdLeftHandle"
            android:layout_width="20dp"
            android:layout_height="50dp"
            android:background="@drawable/shape_rounded_corners_gray_right"
            android:rotation="180"
            android:scaleType="center"
            android:src="@drawable/icon_arrow_left" />

        <LinearLayout
            android:id="@+id/sdLeftContent"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:clickable="true"
            android:orientation="vertical"
            android:rotation="180"
            android:weightSum="1" >

            <requestFocus />

            <ImageView
                android:id="@+id/imgFavourite"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_margin="10dp"
                android:layout_marginBottom="5dp"
                android:layout_marginTop="5dp"
                android:layout_weight=".1"
                android:background="@drawable/border_image"
                android:clickable="true"
                android:scaleType="center"
                android:src="@drawable/icon_content_like" />

            <ImageView
                android:id="@+id/imgFolder"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_margin="10dp"
                android:layout_marginBottom="5dp"
                android:layout_marginTop="5dp"
                android:layout_weight=".1"
                android:background="@drawable/border_image"
                android:clickable="true"
                android:scaleType="center"
                android:src="@drawable/icon_content_add_folder" />

            <ImageView
                android:id="@+id/imgShare"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_margin="10dp"
                android:layout_marginBottom="5dp"
                android:layout_marginTop="5dp"
                android:layout_weight=".1"
                android:background="@drawable/border_image"
                android:clickable="true"
                android:scaleType="center"
                android:src="@drawable/icon_content_share" />

            <ImageView
                android:id="@+id/imgComment"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_margin="10dp"
                android:layout_marginBottom="5dp"
                android:layout_marginTop="5dp"
                android:layout_weight=".1"
                android:background="@drawable/border_image"
                android:clickable="true"
                android:scaleType="center"
                android:src="@drawable/icon_content_comment" />

        </LinearLayout>
    </SlidingDrawer>

我正在点击这些图像视图进行一些操作。但当我点击这些图像视图时,滑动内容后面的屏幕就会触动事件。我已经使这些图像视图可以点击,但没有像onClick和onTouch这样的事件


提前感谢

首先,您添加了

android:clickable=“true”
用于您的
LinearLayout
。如果这是必须的

尝试添加

android:genderantfocusability=“blocksDescendants”
SlidingDrawer
tag

如果这不起作用,保持原样,并添加

        android:focusable="false"
        android:focusableInTouchMode="false"
对于使其可单击的每个
ImageView

这似乎是一个解决方案不那么优雅的问题。我能够找到一个解决方案,通过窗口截获完整的事件并相应地采取行动


请查看我找到的@unflagged.destination是否尝试从
线性布局中删除
android:clickable=“true”
?。还可以尝试创建
ImageView
s
android:clickable=false
。A我可以看出混淆基本上是,android:clickable=“true”在LinearLayout中,并且在其内部有可点击的元素