【发布时间】:2015-11-12 01:26:27
【问题描述】:
我正在尝试像在 google play 应用中那样实现透明阴影。 当您向下滚动时,瓷砖位于阴影后面,但您可以看到它们将其扔掉。在此处查看示例图片:
我创建了一个视图,我可以通过
添加到布局中<include layout="@layout/toolbar_shadow" />
toolbar_shadow.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="4dp"
android:background="@drawable/shadow"
/>
</LinearLayout>
shadow.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="@android:color/transparent"
android:centerColor="#33333333"
android:endColor="#aa666666"
android:angle="90" />
</shape>
我得到的是一个不透明的阴影。当瓷砖在其后面移动时,它会被白色/灰色* 颜色覆盖。
*endColor="#aa666666" 来自 shadow.xml
有人可以帮我吗?
【问题讨论】:
-
你能贴出包含阴影的整个布局文件吗?
标签: android xml view transparency shadow