Originally created a navigation drawer template, this template created automatic markup ( enter image description here ). In general, I try to use BottomNavigationView, I added activity_main.xml to the main markup, I launch the application and the menu in the middle, but it must be tied to Bottom.

activity_main.xml

<?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.DrawerLayout android:id="@+id/drawer_layout" 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: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"/> <android.support.design.widget.BottomNavigationView android:id="@+id/bottom_navigation" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" app:itemBackground="@color/navigation" app:itemIconTint="@color/bottom_navigation_item_background_colors" app:itemTextColor="@color/bottom_navigation_item_background_colors" app:menu="@menu/bottomnavigationview" /> </android.support.v4.widget.DrawerLayout> 

Content: content_main

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

 <ScrollView android:id="@+id/scrollViewcontent" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:id="@+id/content_main" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="left" android:orientation="vertical" android:padding="30dp"> <TextView android:id="@+id/fio" android:layout_width="wrap_content" android:layout_height="wrap_content" android:drawableLeft="@drawable/star_512" android:drawablePadding="8dp" android:text="@string/fion"/> <EditText android:id="@+id/fiontext" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:layout_marginTop="15dp" android:clickable="true" android:ems="10" android:focusable="true" android:focusableInTouchMode="true" android:hint=" " android:inputType="textMultiLine" android:lineSpacingMultiplier="2" android:maxLength="20" android:maxLines="2" android:text="" /> <TextView android:id="@+id/fionuri" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="20dp" android:text="@string/adrespropiski"/> <TextView android:id="@+id/naselpun" android:layout_width="wrap_content" android:layout_height="wrap_content" android:drawableLeft="@drawable/star_512" android:drawablePadding="8dp" android:text="@string/naselpunkt"/> <EditText android:id="@+id/naspunkt" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:layout_marginTop="20dp" android:clickable="true" android:ems="10" android:focusable="true" android:focusableInTouchMode="true" android:hint=" " android:inputType="textMultiLine" android:lineSpacingMultiplier="2" android:maxLength="20" android:maxLines="2" android:selectAllOnFocus="false" android:text=""/> <TextView android:id="@+id/adres_ul" android:layout_width="wrap_content" android:layout_height="wrap_content" android:drawableLeft="@drawable/star_512" android:drawablePadding="8dp" android:text="@string/adres"/> <EditText android:id="@+id/ulica" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:layout_marginTop="20dp" android:clickable="true" android:ems="10" android:focusable="true" android:focusableInTouchMode="true" android:hint=" " android:inputType="textMultiLine" android:lineSpacingMultiplier="2" android:maxLength="20" android:maxLines="5" android:selectAllOnFocus="false" android:text=""/> <TextView android:id="@+id/phonetext" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="15dp" android:drawableLeft="@drawable/star_512" android:drawablePadding="8dp" android:text="@string/dom"/> <EditText android:id="@+id/dom" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:clickable="true" android:ems="10" android:focusable="true" android:focusableInTouchMode="true" android:hint="" android:inputType="phone" android:maxLength="30"/> <TextView android:id="@+id/email" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="15dp" android:drawableLeft="@drawable/star_512" android:drawablePadding="8dp" android:text="@string/email"/> <EditText android:id="@+id/emailfild" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:clickable="true" android:ems="10" android:focusable="true" android:focusableInTouchMode="true" android:hint="" android:inputType="textEmailAddress" android:maxLength="20"/> <TextView android:id="@+id/mesag" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="15dp" android:drawableLeft="@drawable/star_512" android:drawablePadding="8dp" android:text="@string/messag"/> <EditText android:id="@+id/mesages" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginTop="10dp" android:clickable="true" android:ems="10" android:focusable="true" android:focusableInTouchMode="true" android:hint="введите ваше сообщение" android:inputType="textMultiLine" android:maxLength="1000" android:maxLines="5"/> </LinearLayout> </ScrollView> 

enter image description here

UPDATE: with markup:

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

 <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"> <include layout="@layout/app_bar_main" android:layout_width="match_parent" android:layout_height="match_parent" /> <android.support.design.widget.BottomNavigationView android:id="@+id/bottom_navigation" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" app:itemBackground="@color/navigation" app:itemIconTint="@color/bottom_navigation_item_background_colors" app:itemTextColor="@color/bottom_navigation_item_background_colors" app:menu="@menu/bottomnavigationview" /> </RelativeLayout> <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" /> 

enter image description here

  • 2
    Emm ... android:layout_alignParentBottom="false" . - post_zeew
  • The first markup is what? How does she relate to the second? - xkor
  • @xkor I indicated that I created a navigation drawer template that automatically created markup for content and for widgets. first markup: activity_main - upward
  • Well, I have no navigation drawer in your layouts and I don’t see in the screenshot what kind of porridge resembles the side menu in any way - xkor
  • you only have a piece of activity_main.xml, and nothing definite can be said about it - xkor

2 answers 2

Hey. Do you have it all in CoordinatorLayout? if not, first wrap the entire layout in the CoordinatorLayout. And try to set for BottomNavigationView android: layout_gravity = "bottom"

    You have a BottomNavigationView directly in a DrawerLayout that knows nothing about the layout_alignParentBottom attribute. Actually this attribute works only in RelativeLayout. In DrawerLayout , it’s necessary, as you’ve already suggested in the other answer, to use android:layout_gravity="bottom" , but I’m not sure how DrawerLayout support for the layout_gravity attribute is in layout_gravity . In addition, your BottomNavigationView described after NavigationView and, accordingly, will be displayed over the side menu when it is open. I would recommend that you change activity_main.xml like this:

     <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.DrawerLayout android:id="@+id/drawer_layout" 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:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" tools:openDrawer="start"> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"> <include layout="@layout/app_bar_main" android:layout_width="match_parent" android:layout_height="match_parent"/> <android.support.design.widget.BottomNavigationView android:id="@+id/bottom_navigation" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" app:itemBackground="@color/navigation" app:itemIconTint="@color/bottom_navigation_item_background_colors" app:itemTextColor="@color/bottom_navigation_item_background_colors" app:menu="@menu/bottomnavigationview" /> </RelativeLayout> <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"/> </android.support.v4.widget.DrawerLayout> 
    • I updated the cap and attached the result with your layout - upward
    • @upward is very strange, tried to create an empty project with a similar markup and the lower bar is quite a bottom: monosnap.com/file/NYFfSucHfG4keu8CZdoMhhXrRormbD . I really have the latest versions of sdk now. In the evening after work I will try with the latter. - xkor
    • @upward eh, that I have a general with 25 sdk and sapport libs did not want to start up in any way ( - xkor