NavigationDrawer
Нужно в приложение добавить меню(NavigationDrawer). Как я поняла это делается в DrawerLayout, но у меня в активити уже есть ConstraintLayout. Подскажите как добавить пожалуйста
<androidx.constraintlayout.widget.ConstraintLayout 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=".MainActivity"
tools:viewBindingIgnore="true">
<androidx.fragment.app.FragmentContainerView
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="280dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.fragment.app.FragmentContainerView
android:id="@+id/container2"
android:layout_width="match_parent"
android:layout_height="280dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
Ответы (1 шт):
Автор решения: Alex Sus
→ Ссылка
В Android Studio есть целый шаблон для нового проекта: Navigation Drawer Activity.
Создайте новый проект используя этот шаблон, посмотрите, как там всё устроено, скопируйте себе.