you can simply use a FrameLayout with 2 nested views inside, first add your ImageView and then add a view with gradient shape.
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/dragon_ball_super" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/shome_gradient_shape"/>
</FrameLayout>
You can set a color filter like this:
background.setColorFilter(Color.RED, PorterDuff.Mode.SRC_IN);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.