Reputation: 47
here i am asking for your help.
I'm trying to implement a nestedscrollview inside a coordinatorlayout with some other stuff but the nestedscroll view keeps transparent no matter what i do.
I have already thought a lot but couldn't find any solution.
I want it to have a "solid" white background not this (+/- 30% white) background, here as some printscreens:
Then when i start it sliding:
As we can see it the background text (that is inside the coordinator but out the nested) still readable and i can even start actions like press the drawer button that should be hidden.
Here is my main layout code which hold the NestedScrollView:
<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"
tools:context=".MainActivity">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:scrollbars="none"
app:behavior_hideable="true"
app:behavior_peekHeight="64dp"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
<include layout="@layout/fragment_fast_access" />
</androidx.core.widget.NestedScrollView>
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:theme="@style/AppTheme.AppBarOverlay">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@android:color/transparent"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</com.google.android.material.appbar.AppBarLayout>
<include layout="@layout/content_main" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
And this is the Fragment i want to show inside it:
<androidx.constraintlayout.widget.ConstraintLayout 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"
tools:context=".FastAccessFragment">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_begin="288dp" />
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="64dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="64dp">
<ImageView
android:id="@+id/fastAccess_inCard_coverAlbum"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_gravity="center"
android:layout_marginStart="16dp"
android:contentDescription="@string/album_cover"
android:scaleType="centerCrop"
android:src="@drawable/gradient_bg_main"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/fastAccess_inCard_songName"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginHorizontal="16dp"
android:layout_marginBottom="2dp"
android:ellipsize="end"
android:gravity="bottom"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textColor="@android:color/black"
app:layout_constraintBottom_toTopOf="@id/fastAccess_inCard_artistName"
app:layout_constraintEnd_toStartOf="@id/fastAccess_inCard_buttonPlay"
app:layout_constraintStart_toEndOf="@id/fastAccess_inCard_coverAlbum"
app:layout_constraintTop_toTopOf="parent"
tools:text="Song name" />
<TextView
android:id="@+id/fastAccess_inCard_artistName"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginHorizontal="16dp"
android:ellipsize="end"
android:maxLines="1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/fastAccess_inCard_buttonPlay"
app:layout_constraintStart_toEndOf="@id/fastAccess_inCard_coverAlbum"
app:layout_constraintTop_toBottomOf="@id/fastAccess_inCard_songName"
tools:text="Artist" />
<ImageButton
android:id="@+id/fastAccess_inCard_buttonPlay"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginEnd="16dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:clickable="true"
android:contentDescription="@string/button_play"
android:focusable="true"
android:src="@drawable/ic_play"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/fastAccess_inCard_buttonPlaylist"
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="@+id/fastAccess_inCard_buttonPlaylist"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="16dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:clickable="true"
android:contentDescription="@string/show_playlist"
android:focusable="true"
android:scaleType="centerCrop"
android:src="@drawable/ic_playlist"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout>
Thanks in advance ;)
Upvotes: 1
Views: 285