Ограничение размера области экрана для меню
В приложении есть такое навигационное меню:

И на разных телефонах оно занимает разную часть экрана, как сделать чтоб при любом разрешении это меню было в самом низу, и чтоб не закрывало элементы которые идут выше него . Заранее спасибо !
разметка:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:menu="@menu/bottom_menu"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activity.ChatListActivity">
<RelativeLayout
android:id="@+id/new_layout_relative"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="55dp"> </RelativeLayout>
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottom_nav"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:menu="@menu/bottom_menu"/>
</androidx.constraintlayout.widget.ConstraintLayout>
Это экран с меню, а остальные экраны в виде фрагментов . Пример:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewChat"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
Ответы (1 шт):
Автор решения: Andrew
→ Ссылка
Вот например есть разметка:
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout 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"
tools:context=".screens.HomeScreen">
<FrameLayout
android:id="@+id/contentContainerT"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/bottom_navigation_t"
android:layout_marginBottom="56dp" />
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottom_navigation_t"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom"
app:itemBackground="@color/bottom_nav_color"
app:itemIconTint="@drawable/selected_text"
app:itemTextColor="@drawable/selected_text"
app:labelVisibilityMode="labeled"
app:menu="@menu/main_bottom_nav_menu" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
здесь менюшка всегда висит внизу экрана и никуда не девается на любых устроствах. И вообще у вас есть строка:
android:layout_alignParentBottom="true"
которая должна решать вашу проблему. Попробуйте убрать
android:layout_alignParentBottom="true"
может конфликтует.
