Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to put black transparent on image in 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.

enter image description here

like image 625
Ramesh Avatar asked Nov 21 '14 12:11

Ramesh


1 Answers

try this

<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>

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>
like image 168
Shijil Avatar answered Oct 01 '22 09:10

Shijil