Проблема: я хочу, чтобы мой Навигационный ящик был совместимым для таких устройств, как Nexus S (4,0 дюйма), а также с возможностью прокрутки между заголовком навигации и нижним колонтитулом . В Android Studio Layout отлично смотрится с размером экрана, но когда я запускаю приложение в эмуляторе с тем же размером экрана, нижний колонтитул навигации перекрывает пункты меню.
Вот мой код.
Activity_dashboard. xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout android:id="@+id/dashboardDrawer"
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:context="com.codingblocks.cbonlineapp.dashboard.DashboardActivity"
tools:openDrawer="start">
<include
layout="@layout/app_bar_dashboard"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<com.google.android.material.navigation.NavigationView
android:id="@+id/dashboardNavigation"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:isScrollContainer="true"
android:scrollbars="vertical"
app:headerLayout="@layout/nav_header_home"
app:itemHorizontalPadding="35dp"
app:itemIconPadding="@dimen/margin_large"
app:itemTextAppearance="@style/NavigationDrawerStyle"
app:menu="@menu/activity_home_drawer">
<com.google.android.material.navigation.NavigationView
android:id="@+id/footer_drawer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom">
<LinearLayout
android:id="@+id/referralContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@drawable/background_orange"
android:clickable="true"
android:focusable="true"
android:gravity="center_vertical"
android:onClick="openReferral"
android:orientation="horizontal"
android:padding="16dp"
android:visibility="visible">
<ImageView
android:layout_width="34dp"
android:layout_height="34dp"
android:src="@drawable/ic_goodie"
android:tint="@color/white" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_medium_small"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/gilroy_bold"
android:text="@string/invite_earn"
android:textColor="@color/white"
android:textSize="18sp" />
<TextView
android:id="@+id/logout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/gilroy_medium"
android:lines="1"
android:text="@string/earn_upto_2000_wallet_credits"
android:textColor="@color/white"
android:textSize="14sp" />
</LinearLayout>
</LinearLayout>
</com.google.android.material.navigation.NavigationView>
</com.google.android.material.navigation.NavigationView>
</androidx.drawerlayout.widget.DrawerLayout>
nav_header_home. xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="@dimen/nav_header_height"
android:id="@+id/navViewProfileRoot"
android:clickable="true"
android:onClick="openProfile"
android:focusable="true"
android:layout_width="match_parent"
android:paddingTop="20dp"
android:background="@drawable/toolbar_bg_dark"
android:gravity="center_vertical">
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/navHeaderImageView"
android:layout_width="55dp"
app:civ_border_color="@color/white"
app:civ_border_width="1dp"
android:layout_height="55dp"
android:layout_marginStart="@dimen/margin_large"
android:src="@drawable/defaultavatar" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_medium"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/navUsernameTv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/gilroy_bold"
android:text="@string/hello"
android:textColor="@color/white"
android:textSize="18sp" />
<TextView
android:id="@+id/navViewProfileTv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:fontFamily="@font/gilroy_medium"
android:text="@string/view_profile"
android:textColor="@color/orangish"
android:textSize="14sp" />
</LinearLayout>
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="24dp"
android:src="@drawable/ic_dropright_big"
android:tint="@color/white" />
</LinearLayout>
Снимок экрана Android Предварительный просмотр макета студии (обязательно) и Предварительный просмотр устройства (актуально).
