0

I have a button in my main content and I want this button to stay at the same position when I open the Navigation Drawer and above the Navigtion Drawer.

I have already tried to put a margin on the navigation drawer, but the problem then was that the button disappeared under the black/transparent space that is around the navigation drawer.

Ideas?

AstroCB
  • 12,337
  • 20
  • 57
  • 73

1 Answers1

0

Got your point, try code below in your layout:

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

Try some trial and error in code buddy, Hope it helped.

Harin
  • 2,413
  • 3
  • 15
  • 30