Ram*_*esh 6 java xml android android-layout android-fragments
我有一个图像,我想在底部添加黑色透明,以显示文本细节.从服务器我将得到正常的图像,我想转换它如下.在下图中,您可以看到图像的底部是黑色透明的.

Shi*_*jil 28
试试这个
<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>
Run Code Online (Sandbox Code Playgroud)
和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>
Run Code Online (Sandbox Code Playgroud)