将按钮保持在打开导航抽屉上方

Keep Button above opening Navigation Drawer

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

我已经尝试在导航抽屉上放置边距,但问题是导航抽屉周围的 black/transparent space 下方的按钮消失了。

想法?

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

<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>

在 code buddy 中尝试一些尝试和错误,希望对您有所帮助。