D
D
Dewerro2021-08-06 11:26:40
Android
Dewerro, 2021-08-06 11:26:40

Android: Can a NestedScrollView along with a CollapsingToolbarLayout have a non-rectangular background?

If you bind NestedScrollView to CollapsingToolbarLayout then they cannot be separated from each other. But the problem is that if you set the NestedScrollView to the top of the View that is not a rectangle, for example , then this gap occurs . As intended, it should look like this . If you stretch the CollapsingToolbarLayout down, then this View will also move, but this should not happen.

<com.google.android.material.appbar.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="126dp"
    android:fitsSystemWindows="true">

    <com.google.android.material.appbar.CollapsingToolbarLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/cyan"
        android:fitsSystemWindows="true"
        app:layout_scrollFlags="scroll|exitUntilCollapsed"
        app:toolbarId="@+id/toolbar">

        <carbon.widget.RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_collapseMode="parallax">

            <!-- content of AppBarLayout-->

        </carbon.widget.RelativeLayout>

    </com.google.android.material.appbar.CollapsingToolbarLayout>

</com.google.android.material.appbar.AppBarLayout>

<androidx.core.widget.NestedScrollView
    android:id="@+id/nested_scroll_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:overScrollMode="never"
    android:scrollbars="none"
    app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">

    <!-- content of NestedScrollView -->

</androidx.core.widget.NestedScrollView>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg, 2021-08-06
@402d

try making the fab button
app:layout_anchor="@+id/app_bar"
app:layout_anchorGravity="bottom|right|end"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question