在Android中滑动抽屉问题

时间:2012-07-10 11:43:28

标签: android android-intent android-ui

我在活动中使用listview和slidedrawer。我的目的是打开slidedrawer并在列表项单击时显示内容。 slidedrawer内容将根据所选项目进行更改。

UI布局如下所示。

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<ListView
    android:id="@+id/presentation_list"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >
</ListView>

<SlidingDrawer
    android:id="@+id/slidingDrawer1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:content="@+id/content"
    android:handle="@+id/handle"
    android:orientation="horizontal" >

    <Button
        android:id="@+id/handle"
        android:layout_width="40dp"
        android:layout_height="fill_parent"
        android:background="@android:color/darker_gray" />

    <LinearLayout
        android:id="@+id/content"
        android:layout_width="match_parent"
        android:layout_height="match_parent"

        android:orientation="vertical" >

        <TextView
            android:id="@+id/textView1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="Presentation&apos;s Images.. Please Flip"
            android:textColor="@android:color/black"
            android:textStyle="bold" />
        <ImageView
            android:id="@+id/content_imageview"
            android:layout_width="match_parent"
            android:layout_height="200dp"
            android:background="@android:color/black" 
            android:layout_below="@id/presentation_list"
            />
    </LinearLayout>
</SlidingDrawer>

点击listview滑块打开,当我点击slidedrawer的imageview时,我的listview也被点击了。控件进入listview项目单击方法并且图像被更改

有人可以帮我纠正这个问题吗?

1 个答案:

答案 0 :(得分:5)

android:clickable属性添加到content布局并将其设置为true

<LinearLayout
        android:id="@+id/content"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:clickable="true" >

不幸的是,我无法解释为什么会这样。

相关问题