Make ImageView have dark transparency
Try this second imageview will set the transparent color. Adjust the height according to your need.
500000 - last 4 digits stands for black color and first two stands for alpha you want to set.
<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"
/>
<ImageView
android:layout_width="match_parent"
android:layout_height="150dp"
android:background="#500000"
/>
</RelativeLayout>
You can add foreground tint with tint mode.
Make sure you add alpha channel in your foreground color.
foreground="##AARRGGBB"
AA = alpha channel in HEX R,G,B = Red, Blue, Green.
<ImageView
android:id="@+id/vidthumbnail"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:foreground="#96222f3e"
android:foregroundTintMode="src_atop"/>
What you need is called tinting. Apply a tint to your ImageView
:
<ImageView
...
app:tint="#6F000000"
/>
Easiest/Fastest solution would be in XML
Add a second layer (can be a View, doesn't have to be an ImageView) on top of your ImageView, with the desired color/alpha. Show/Hide it when needed.
<ImageView
android:id="@+id/rest_image"
android:layout_width="match_parent"
android:layout_height="150dp"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
/>
<View
android:id="@+id/overlay_image"
android:layout_width="match_parent"
android:layout_height="150dp"
android:background=“@color/yourColorWithAlpha"
/>
</RelativeLayout>