简体   繁体   English

滑动抽屉在其他视图之上

[英]SlidingDrawer above other views

how do i place a slidingdrawer above another view so i doesnt come out from the bottom of the screen, but from the top of another view ? 如何将滑动抽屉放在另一个视图上方,这样我就不会从屏幕底部出来,而是从另一个视图顶部出来?

my code so far: 到目前为止我的代码:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:orientation="vertical"
          android:background="@drawable/splash">
  <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                  android:layout_width="fill_parent"
                  android:layout_height="wrap_content"
                  android:layout_gravity="bottom"
                  android:background="#000000">
     <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                   android:layout_width="fill_parent"
                   android:layout_height="fill_parent"
                   android:orientation="vertical"
                   android:background="@drawable/splash">
        <Button android:id="@id/content"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="I'm in here!"/>
     </LinearLayout>
     <SlidingDrawer android:id="@+id/drawer"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:handle="@+id/handle"
                    android:content="@+id/content">
        <ImageView android:id="@id/handle"
                   android:layout_width="wrap_content"
                   android:layout_height="wrap_content"
                   android:src="@drawable/categories_bar_flipped"/>
        <Button android:id="@id/content"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:text="I'm in here!"/>
     </SlidingDrawer>
  </RelativeLayout>
  <EditText xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"/>
</LinearLayout>

problem is that the EditText disappeares and the sliderhandle is dokked at bottom of screen instead of at top of the EditText 问题是EditText消失了,滑块句柄位于屏幕底部而不是EditText顶部

Use a framelayout which will stack views on top of each other based on the order of the childs. 使用框架布局,该框架布局将根据子项的顺序将视图堆叠在一起。 That should make the drawer appear on top. 那应该使抽屉出现在顶部。

Check some answers: 检查一些答案:

It has code examples of how to do that. 它具有有关如何执行此操作的代码示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM