1

I work in bottom navigation drawer which is bottom of an app, I added scrollView as well but my contents goes behind the bottom navigation, why? How to fix it?

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".AdminHome">


    <android.support.design.widget.BottomNavigationView
        android:id="@+id/navigation"
        app:itemBackground="@color/colorPrimary"
        android:layout_width="match_parent"
        android:layout_height="56dp"
        android:layout_marginStart="0dp"
        android:layout_marginEnd="0dp"
        app:itemIconTint="@color/nav_item_color"
        app:itemTextColor="@color/nav_item_color"
        android:background="?android:attr/windowBackground"
        android:layout_alignParentBottom="true"
        app:menu="@menu/navigation" />

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="100dp"
        android:id="@+id/header"
        android:background="@color/colorPrimary">


        <ImageView
            android:layout_width="220px"
            android:layout_height="220px"
            android:id="@+id/profilePic"
            android:layout_margin="5dp"
            android:src="@mipmap/ic_launcher_round"/>


    </RelativeLayout>



    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/line"
        android:layout_above="@+id/navigation"
        android:layout_margin="10dp">




    </ScrollView>

</RelativeLayout>

Because of too much lengthy code I short my code and just give concept.

Masoud Mokhtari
  • 2,390
  • 1
  • 17
  • 45
Learn Do
  • 41
  • 1
  • 5

1 Answers1

0

What is line at below:

<ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/line"
        android:layout_above="@+id/navigation"
        android:layout_margin="10dp">

I think you must set like this:

<ScrollView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@id/header"
            android:layout_above="@+id/navigation"
            android:layout_margin="10dp">
Masoud Mokhtari
  • 2,390
  • 1
  • 17
  • 45
  • the line is actually id of an header that u define but it doesn't work – Learn Do Feb 17 '19 at 16:43
  • are you sure? because of I test your layout in device an emulator and its worked correctly. – Masoud Mokhtari Feb 18 '19 at 04:39
  • i draw a line below header thats why its layout below line , but contents goes behind the navigation , i draw linear layout inside scroll view and there are a lot of contents but when i scroll and the last contents goes behind – Learn Do Feb 18 '19 at 06:53
  • please check this [link](https://stackoverflow.com/questions/28303342/application-content-goes-behind-the-navigation-bar-in-android-l) and guide me how it works in my case – Learn Do Feb 18 '19 at 06:57