如何在图像上添加阴影(在底部)以使标题清晰可见。
请参见下图。
我写了一个应用程序,也有同样的效果。我所做的是,我创建了一个框架布局其中有图像视图和另一个View它与 ImageView 具有相同的高度。然后我添加一个透明的渐变背景View.
Example:
布局文件:
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="match_parent"
android:layout_height="180dp"
android:src="@drawable/image"
android:adjustViewBounds="true" />
<View
android:layout_width="match_parent"
android:layout_height="180dp"
android:background="@drawable/gradient" />
</FrameLayout>
可绘制/渐变.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="90"
android:endColor="#00ffffff"
android:startColor="#aa000000"
android:centerColor="#00ffffff" />
</shape>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)