How can I add a shadow over the image (right at the bottom) in order to have the title to be clearly visible. See the image below.
I wrote an application, which has the same effect. What I did is, I created a FrameLayout which has the ImageView and another View which has the same height of the ImageView. Then I add a transparent gradient background to the View.
Example:
Layout file:
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="match_parent"
android:layout_height="180dp"
android:src="@drawable/image"
android:adjustViewBounds="true" />
<View
android:layout_width="match_parent"
android:layout_height="180dp"
android:background="@drawable/gradient" />
</FrameLayout>
drawable/gradient.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="90"
android:endColor="#00ffffff"
android:startColor="#aa000000"
android:centerColor="#00ffffff" />
</shape>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With