Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make ImageView have dark transparency

I want to add the transparent black color on top of the image and make it darker.

enter image description here

          <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent">

                <ImageView
                    android:id="@+id/rest_image"
                    android:layout_width="match_parent"
                    android:layout_height="150dp"
                    android:adjustViewBounds="true"
                    android:scaleType="centerCrop"
                    />
            </RelativeLayout>

I can set the alpha parameter but the color change is in white. I want to make the darker image like this. How can i do it in xml or Java code. I will set it based on condition.?

Thanks.

like image 246
Karesh A Avatar asked Oct 04 '17 13:10

Karesh A


1 Answers

What you need is called tinting. Apply a tint to your ImageView:

<ImageView
    ...
    app:tint="#6F000000"
    />
like image 163
azizbekian Avatar answered Sep 18 '22 22:09

azizbekian