I am trying to use a toolbar with custom shape, and I want to show the text from my NestedScroll under the AppBarLayout.
But I am with some problems as you can see in this screenshot:
How can I achieve this goal?
My XML:
<androidx.coordinatorlayout.widget.CoordinatorLayout 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="match_parent"
android:background="@android:color/transparent"
android:animateLayoutChanges="true">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:background="@null"
app:elevation="0dp">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="94dp"
android:background="@drawable/background_header_asset"
app:layout_collapseMode="pin"/>
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/ipsun" />
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
PS.: the toolbar background is a drawable shape, so its transparent
Edit:
My shape is:
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="320dp"
android:height="94dp"
android:viewportWidth="320"
android:viewportHeight="94">
<path
android:pathData="M320,73.153L81.283,92.257C64.54,93.42 54.316,94
50.612,94c-3.705,0 -8.826,-1.771 -15.363,-5.314L0,70.176V0h320v73.153z"
android:fillColor="#01874D"
android:fillType="evenOdd"/>
</vector>
from Android NestedScroll under AppBarLayout
No comments:
Post a Comment