微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Android:有没有一种方法可以将SlidingDrawer的宽度和高度正确设置为半屏?

我必须在右侧设置一个SlidingDrawer并单击,它不应在半屏上展开.我看到了很多tuto,并且设法或多或少正确地设置了它,但是当前它正在将布局中的所有内容推到左侧.这是我的xml:

<LinearLayout android:layout_height="wrap_content"
    android:id="@+id/edition_content_linear" android:layout_width="fill_parent"
    android:layout_weight="1" android:background="@android:color/white">

    <LinearLayout android:layout_width="fill_parent"
        android:id="@+id/static_menu_layout" android:layout_height="fill_parent"
        android:layout_weight="2" android:visibility="gone" android:background="@drawable/ipad_category_back">

        <ExpandableListView android:id="@+id/static_expandable_list"
            android:layout_height="fill_parent" android:layout_width="fill_parent"
            android:drawSelectorOnTop="false" android:groupIndicator="@drawable/expandablelist_selector" android:indicatorLeft="210dp" android:indicatorRight="230dp"></ExpandableListView>

    </LinearLayout>

    <LinearLayout android:id="@+id/center_linear"
        android:layout_width="fill_parent" android:layout_height="fill_parent"
        android:layout_weight="1">

        <ImageView android:scaleType="centerInside"
            android:layout_height="fill_parent" android:layout_width="fill_parent"
            android:id="@+id/cover_image_big"></ImageView>

        <WebView android:id="@+id/story_webview"
            android:layout_height="fill_parent" android:layout_width="fill_parent"
            android:visibility="gone"></WebView>

    </LinearLayout>

    <SlidingDrawer android:id="@+id/slider_drawer"
    android:layout_width="250dp" android:layout_height="500dp"
    android:orientation="horizontal" android:layout_gravity="center_vertical"
    android:handle="@+id/slider_handle" android:content="@+id/slider_expandable_list_container">

    <ImageView android:id="@+id/slider_handle"
        android:layout_width="wrap_content" android:layout_height="wrap_content"
        android:src="@drawable/menu_handler" />

    <RelativeLayout android:id="@+id/slider_expandable_list_container"
        android:layout_height="500dp" android:layout_width="250dp">
        <ExpandableListView android:id="@+id/slider_expandable_list"
            android:layout_height="fill_parent" android:layout_width="fill_parent"
            android:drawSelectorOnTop="false" android:indicatorLeft="210dp" android:layout_gravity="center_vertical"
            android:indicatorRight="230dp" android:groupIndicator="@drawable/expandablelist_selector"></ExpandableListView>

    </RelativeLayout>

   </SlidingDrawer>

</LinearLayout>

解决方法:

将滑动抽屉放置在框架布局中总是更好.因为在Framelayout中,视图将彼此绘制.然后,即使您打开抽屉,它也会在下面的视图中重叠.但请注意,在Framelayout中,抽屉会扩展到所有framelayout的长度.如果要限制扩展抽屉的长度,请为父框架布局指定一个长度.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐