Java 在其他视图上方滑动抽屉
如何在另一个视图上方放置滑动抽屉,使我不会从屏幕底部出来,而是从另一个视图的顶部出来 到目前为止,我的代码是:Java 在其他视图上方滑动抽屉,java,android,slidingdrawer,Java,Android,Slidingdrawer,如何在另一个视图上方放置滑动抽屉,使我不会从屏幕底部出来,而是从另一个视图的顶部出来 到目前为止,我的代码是: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_hei
<?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>
问题是EditText消失,幻灯片手柄放在屏幕底部,而不是EditText顶部。请使用框架布局,根据孩子的顺序将视图堆叠在彼此的顶部。这将使抽屉显示在顶部。检查一些答案:
- -图书馆可以这样做吗
它有一些代码示例说明如何实现这一点。我认为滑动抽屉必须靠在屏幕边缘。如果您需要一些不同的行为,您可能需要扩展SlidingDrawer并创建自定义视图。