在其他视图上方滑动抽屉
如何将滑动抽屉放置在另一个视图上方,这样我就不会从屏幕底部出来,而是从另一个视图的顶部出来?
到目前为止我的代码:
<?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 顶部
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用框架布局,它将根据子视图的顺序将视图堆叠在一起。这应该使抽屉出现在顶部。
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.