【发布时间】:2017-02-23 18:14:07
【问题描述】:
我搜索了这个问题,发现了很多答案,人们声称这些答案有效,我不怀疑。但是,就我而言,这些答案都没有帮助。我需要工具栏下的透明渐变视图,以便在滚动RecyclerView 时,它在该渐变视图下可见。甚至可能吗?
我试过这样做:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="#e9e8e9"
android:endColor="#30ffffff"
android:angle="270"
>
</gradient>
但是,这不会产生任何透明度。我也试过"@android:color/transparent",但还是不行。
这是布局的方式:
<RelativeLayout
android:id="@+id/layout_button_category">
....
</RelativeLayout>
<View android:id="@+id/shadow"
android:layout_below="@+id/layout_button_category"
android:layout_width="match_parent"
android:layout_height="24dp"
android:dither="true"
android:background="@drawable/shadow"
xmlns:android="http://schemas.android.com/apk/res/android" />
</android.support.design.widget.AppBarLayout>
【问题讨论】:
-
您是否将背景设置为
Toolbar -
我做了,但是这个可绘制对象应用于位于下方的视图。此视图始终具有白色背景。