I want to set an image on another image . The base image is of 3600px X 2400px (WxH) The image I want to insert has these conditions:- X: 471px Y: 282px W: 1053px H: 936px X & Y are relative to the base image. All coordinates are in px.
Asked
Active
Viewed 70 times
-1
-
There are lots of questions about this. Please search first before asking https://stackoverflow.com/questions/11959841/how-to-place-an-imageview-on-top-of-another-imageview-in-android – David Rawson Nov 13 '17 at 19:30
-
I am having image size in px not in dp. The questions asked are for dp – Sharad Dadhich Nov 13 '17 at 19:45
-
1@SharadDadhich That doesn't change the answer. Although doing things in exact locations like that are unlikely to work well across multiple screen sizes and should generally be avoided. – Gabe Sechan Nov 13 '17 at 20:27
2 Answers
1
Using a RelativeLayout below one another and some margins (maybe padding will fit) I ommited the android: in all parameters.
<RelativeLayout layout_width="wrap_content" layout_height="wrap_content">
<ImageView
id="@+id/firstOne"
layout_width="360px" layout_height="240px" />
<ImageView
belowOf="@+id/firstOne"
marginTop="28px"
marginLeft="47px"
layout_width="105px" layout_height="93px" />
</RelativeLayout>
I downsized all values by 10 so you can see the result, but you will need to find a relative solution with wrap_contents + adjustViewBounds and scaleMatrix = fitXY

Marcos Vasconcelos
- 18,136
- 30
- 106
- 167
-
-
Yes, you specified exactly values in px, you better using some relative sizes – Marcos Vasconcelos Nov 13 '17 at 19:47
-
i downsized things to you see this answer working as expected – Marcos Vasconcelos Nov 13 '17 at 19:49
-
Ya the thing here is working in small size but i am restricted to work for the provided Image Sizes. Can you provide a solution for the same ? – Sharad Dadhich Nov 13 '17 at 20:29
-
0
Use a FrameLayout. Generally, a FrameLayout is used to hold a single child view otherwise it is difficult. See the documentation

Shamsul Arafin Mahtab
- 539
- 5
- 15