【问题标题】:Keep Button above opening Navigation Drawer将按钮保持在打开的导航抽屉上方
【发布时间】:2015-04-09 18:42:51
【问题描述】:

我的主要内容中有一个按钮,当我打开导航抽屉和导航抽屉上方时,我希望此按钮保持在同一位置。

我已经尝试在导航抽屉上放置一个边距,但问题是按钮在导航抽屉周围的黑色/透明空间下消失了。

想法?

【问题讨论】:

  • 请提供代码或布局xml示例

标签: java android listview navigation drawer


【解决方案1】:

明白你的意思,在你的布局中尝试下面的代码:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.v4.widget.DrawerLayout>
     ...
    </android.support.v4.widget.DrawerLayout>

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:text="Button" />

</RelativeLayout>

在代码伙伴中尝试一些试验和错误,希望它有所帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多