Я недавно начал делать новое приложение. Сейчас я делаю меню. У меня есть пункты выбора города, они должны быть посередине и пункт настройки, который должен быть внизу:
Я делаю меню вот так:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:showIn="navigation_view">
<group
android:id="@+id/cities"
android:checkableBehavior="single">
<item
android:id="@+id/town_1"
android:title="Town 1" />
<item
android:id="@+id/town_2"
android:title="Town 2" />
</group>
<item
android:id="@+id/settingsMenu"
android:title="@string/settings"
android:icon="@drawable/ic_settings"/>
</menu>
А применяю меню вот так:
<androidx.drawerlayout.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:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/dlMain"
android:fitsSystemWindows="true"
tools:context=".ui.activities.main.MainActivity">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/main_background">
...
</androidx.constraintlayout.widget.ConstraintLayout>
<com.google.android.material.navigation.NavigationView
android:id="@+id/nvMain"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:menu="@menu/main_menu"/>
Кто знает как изменять положение отдельных пунктов меню?