I am implementing a DialogFragment where I have lot of contents inside where I would scroll that DialogFragment so I am using:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
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="wrap_content"
android:background="@color/area_frg"
android:orientation="vertical"
tools:context=".MtPopupDialogFragmentPage">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/Theme.AREATracerManager.AppBarOverlay">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/topDialogAppBar"
style="@style/Widget.MaterialComponents.Toolbar.Primary"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:navigationIcon="?attr/homeAsUpIndicator"
app:subtitle="Back to main"
app:subtitleTextColor="@color/white" />
</com.google.android.material.appbar.AppBarLayout>
.
.
.
.
.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/btnResetFW2"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_margin="8dp"
android:layout_gravity="center|center_horizontal"
android:contentDescription="@string/app_name"
android:text="@string/st_restart"
android:textColor="@color/area_bck"
android:textSize="17dp"
android:textAllCaps="true"
android:padding="8dp"
app:layout_anchorGravity="center|center_horizontal"/>
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/btnCheckSW2"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_margin="8dp"
android:layout_gravity="center|center_horizontal"
android:contentDescription="@string/app_name"
android:text="@string/st_check"
android:textColor="@color/bck"
android:textSize="17dp"
android:textAllCaps="true"
android:padding="8dp"
app:layout_anchorGravity="center|center_horizontal"/>
</LinearLayout>
</LinearLayout>
But lasts contents are shrunk to the screen's height, but I'd want to scroll and view all the content...
I tried also to change the top node with ConstraintLayout instead of LinearLayout, but it didn't fix my goal...maybe that's not possible with DialogFragment?
Sure thing! To ensure your DialogFragment's content is properly scrollable and displayed, you shoukd follow these steps:
onCreateDialogmethod usingWindowManager.LayoutParams.If you follow these steps it should work correctly. Hope it helps