我一直在玩AppBarLayout,但是我找不到让背景透明的方法。AppBarLayout透明度
这里我的意思:
这里是我的XML:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.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:fitsSystemWindows="true"
tools:context=".MainActivity">
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:overScrollMode="never"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:elevation="0dp"
android:background="@android:color/transparent">
<TextView
android:id="@+id/toolbar"
app:elevation="0dp"
android:text="hey"
android:textColor="@android:color/white"
android:layout_width="match_parent"
android:layout_height="45dp"
android:background="#8000CDFE"
app:layout_scrollFlags="scroll|enterAlways"/>
</android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>
正如你可以看到我使用的颜色#8000CDFE应该给我50%的透明度,但由于某种原因它没有。我已经尝试将透明背景设置为AppBarLayout,但它也没有多大帮助。
有没有人遇到过这个问题?无论如何要将透明颜色分配给AppBarLayout及其“兄弟姐妹”?
谢谢。
您需要向我们提供一个更完整的XML 。知道你的意见的父母布局可能会有所帮助。 – Ari
@Ari提供了完整的XML – Kistamushken
我认为它是半透明的。 – Apurva