I am setting red
background color in below image. So, it applies red
color in full background. But now, I want to apply red
color based on given height like 30% of image or say 70% of image. So, it should apply color from bottom to top only for 30% or 70% height. I tried it using LinearLayout
params but it is resizing image instead of just background color. How can I do this ?
Here, Inner part of border is transparent and outside part of border is white so it will apply background color only in inner side.
I have solved this issue myself. I used RelativeLayout
with View
and ImageView
. View
with background color and based on height. Check below xml :
<RelativeLayout
android:layout_width="300dp"
android:layout_height="match_parent" >
<View
android:layout_width="300dp"
android:layout_height="150dp"
android:layout_alignParentBottom="true"
android:background="@color/red" >
</View>
<ImageView
android:layout_width="300dp"
android:layout_height="350dp"
android:src="@drawable/ic_image" />
</RelativeLayout>
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.