I'm explaining my problem. First of all, I wanted to let you know that I am a beginner in coding ;) I am currently creating a calculation application. The application is functional and error-free. I would now like to refine the home screen (activity_main.xml) by adding a text. In this same home screen (activity_main.xml), I added a DrawerLayout. However, I have been stuck for several days on a problem.
When a TextView is added to this Drawerlayout, I am confronted with two problems (depending on the positioning of the textview in the code): either the text applies to all fragments whereas it should only be applied to activity_main.xml, or the TextView is not displayed at all.
I would like to have your opinion on my problem and at the same time, find a solution;)
It's an example of my problem :
Thank you in advance for your answer !
<android.support.v4.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/activity_main_drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start"
tools:context="fr.mathieuch.aide_ventil2.MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/open"/>
<!-- 1 | MainActivity RootView -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- Toolbar -->
<android.support.v7.widget.Toolbar
android:id="@+id/activity_main_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:theme="@style/ToolBarStyle"/>
<!-- FrameLayout for our fragments -->
<FrameLayout
android:id="@+id/activity_main_frame_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
<!-- 2 | NavigationView -->
<android.support.design.widget.NavigationView
android:id="@+id/activity_main_nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/activity_main_nav_header"
app:menu="@menu/activity_main_menu_drawer" />
</android.support.v4.widget.DrawerLayout>