在CollapsingToolbarLayout中具有形状和透明背景的RecyclerView

问题描述

我有一个带有appbar_scrolling_view_behavior的recyclerview。我想将recyclerView的背景作为形状,但无法使形状背景透明:

enter image description here

我已将片段中的顶部布局设置为透明,并使仅包含活动的布局具有非透明背景,但是形状背景始终是包含活动布局中设置的任何颜色。

我的recyclerView看起来像这样

enter image description here

    <?xml version="1.0" encoding="utf-8"?>
<layout 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">

    <androidx.coordinatorlayout.widget.CoordinatorLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:animateLayoutChanges="true"
        android:background="@color/sysTransparent"
        android:layoutDirection="ltr"
        tools:context=".fragment.main.MainFragment">

        <com.google.android.material.appbar.AppBarLayout
            android:id="@+id/appbar_layout"
            android:layout_width="match_parent"

            android:background="@color/sysTransparent"
            android:layout_height="290dp">

            <com.google.android.material.appbar.CollapsingToolbarLayout
                android:id="@+id/toolbar_layout"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                app:layout_scrollFlags="scroll|exitUntilCollapsed|enteralways">

                <ImageView
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:alpha="0.25"
                    android:scaleType="centerCrop"
                    android:src="@drawable/random_things" />


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

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


        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/rv_items"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/background_top_cut"
            android:clipToPadding="false"
            android:paddingBottom="100dp"
            app:layout_behavior="@string/appbar_scrolling_view_behavior"
            />

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...