本文介绍了如何在Android中的图像上放置黑色透明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一幅图像,我想在底部添加黑色透明以显示文本详细信息.从服务器,我将获得正常的图像,我希望将其转换如下.在下面的图像中,您可以看到图像的底部是黑色透明的.
I've a image where i would like to add black transparent at bottom to show the text details. From the server i will get the normal images which i would like to convert it like below. In below image you can see that the bottom of the image has black transparent.
推荐答案
尝试一下
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/ur_image" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/gradient_bg" >
</FrameLayout>
和gradient_bg.xml
and gradient_bg.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<gradient
android:angle="90"
android:centerColor="#59000000"
android:endColor="@android:color/transparent"
android:startColor="#000000" />
</shape>
这篇关于如何在Android中的图像上放置黑色透明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!