Background image covering the navdrawer

Asked

Viewed 163 times

1

I have an Activity with a navdrawer on it. And I’d like to put a background image on this Activity. But when I put the image, the Nav disappears, the image is over it. Nav does not lose function, if you click on the image it opens normally but does not appear. How can I resolve this issue?

XML below:

 <?xml version="1.0" encoding="utf-8"?>

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:openDrawer="start">

    <include
        layout="@layout/app_bar_main"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <android.support.design.widget.NavigationView
        android:id="@+id/nav_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:fitsSystemWindows="true"
        app:headerLayout="@layout/nav_header_main"
        app:menu="@menu/activity_main_drawer" />

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_marginStart="@dimen/nav_header_vertical_spacing"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        tools:context=".activity.MainActivity"
        android:background="@drawable/fundo"
        android:layout_alignParentStart="true"
        android:layout_alignParentEnd="true">

        <Button android:id="@+id/btnRoute"
            android:layout_width="223px"
            android:layout_height="327px"
            android:gravity="center"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="100dp"
            android:background="@drawable/rota"/>

        <Button android:id="@+id/btnKeeper"
            android:layout_width="223px"
            android:layout_height="224px"
            android:gravity="center"
            android:layout_below="@+id/btnRoute"
            android:layout_alignStart="@+id/btnRoute"
            android:background="@drawable/keeper"
        />

        <Button android:id="@+id/btnMap"
            android:layout_width="223px"
            android:layout_height="223px"
            android:gravity="center"
            android:layout_below="@+id/btnKeeper"
            android:layout_alignStart="@+id/btnKeeper"
            android:background="@drawable/prevencao"
        />

    </RelativeLayout>

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

Imagem1, sem o fundo

Imagem2, com o fundo

Image or background should be in android.support.v4.widget.Drawerlayout .. and not in relative layout .. solution was this

  • Solved. Should stay on android.support.v4.widget.Drawerlayout and not on relativelayout

1 answer

0

Image or background should be in android.support.v4.widget.Drawerlayout .. and not in relative layout

  • This answer of yours is already the solution to the case?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.