-1

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.

  • 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 Answers2

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
0

Use a FrameLayout. Generally, a FrameLayout is used to hold a single child view otherwise it is difficult. See the documentation