1

Im trying to make a curved a collapsing toolbar but without having a white corners covering my content, I have successfully created the view but even setting the AppBarLayout background to transparent didnt give me transparent edges

 <androidx.coordinatorlayout.widget.CoordinatorLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <com.google.android.material.appbar.AppBarLayout
            android:id="@+id/appBar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/shape_curved_top"
            app:elevation="0dp">


            <com.google.android.material.appbar.CollapsingToolbarLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">



                <androidx.appcompat.widget.Toolbar
                    android:id="@+id/toolbar_home_toolbar"
                    android:layout_width="match_parent"
                    android:layout_height="100dp"
                    app:layout_collapseMode="pin">


                </androidx.appcompat.widget.Toolbar>


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


        </com.google.android.material.appbar.AppBarLayout>
Sarah Maher
  • 790
  • 1
  • 10
  • 21

3 Answers3

1

So I managed to fix this issue by giving a marginTop ="-16dp" to my nested scrolling view and giving the AppBarLayout an elevation so it always covers the nested scrollview.

Dont forget to add the same value you subtracted in the marginTop in the first view.

Sarah Maher
  • 790
  • 1
  • 10
  • 21
0

Maybe try setting android:clipToPadding="false" for the AppBarLayout. At this point I'm just guessing the issue and fix. Here a very nice explanation on what clipToPadding does

0

Try android:outlineProvider="background". Your view must be clipped as background it owns. And then try android:clipToPadding="false".

Artiom
  • 47
  • 1
  • 10