Greum
Well-Known Member
I'm creating an app with a DrawerLayout which shows a blank screen until the menu is displayed. I wanted to add a welcome message on the initial screen.
I tried adding a LinearLayout containing a TextView to the DrawerLayout but the TextView wasn't displayed. Ditto when I tried a TextView by itself.
I guess I could create a new Fragment and load that when the app starts, but that doesn't sound like the best way to approach it.
Is there a way to add a message on the initial screen?
This is my activity_main
I tried adding a LinearLayout containing a TextView to the DrawerLayout but the TextView wasn't displayed. Ditto when I tried a TextView by itself.
I guess I could create a new Fragment and load that when the app starts, but that doesn't sound like the best way to approach it.
Is there a way to add a message on the initial screen?
This is my activity_main
Code:
<?xml version="1.0" encoding="utf-8"?>
<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:id="@+id/drawer_layout"
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" />
<com.google.android.material.navigation.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" />
</androidx.drawerlayout.widget.DrawerLayout>