We are re-designing our Android app and I have created the basic layout in a XML file. I am planning to re-use the same layout in multiple activities but I'm not sure how to include this in a new activity and change just the inner contents (inside the NestedScrollView)? I'll be using this layout in different journeys so can't change those to one-activity and multiple fragments? Is there a clever way of including the base outer layout and change the inner contents in XML? Thanks
Base layout:
<?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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/grey_10">
<com.google.android.material.appbar.AppBarLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:background="@color/grey_10">
<include
android:id="@+id/options_toolbar"
layout="@layout/toolbar_simple"
app:layout_scrollFlags="scroll|enterAlways|snap"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/container_modes"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/grey_10"
android:paddingTop="@dimen/journey_planner_top_padding">
<TextView
android:id="@+id/description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:paddingTop="12dp"
android:paddingBottom="24dp"
android:paddingStart="30dp"
android:paddingEnd="30dp"
android:textSize="16sp"
app:fontFamily="@font/johnston100_light"
android:textColor="@color/johnstonBlack"
android:text="Text"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>