I have a UI in which I have once image as background and Hence it stretches itself to fill the screen. I want to place another image at a particular position w.r.t. original image. How do I do that?
To elaborate more,say I have an image of 320x320 which is at background, and has a white square of 20x20 in it at (50,50)(left top corner) . I have another image of 20x20 which should fill it in. Now w开发者_StackOverflowhen the background stretches, I want this image to stretch & place accordingly so as to fit in that white box itself.
e.g. lets say I've following bckgrnd images with 2 yellow boxes. Now the foregroud image is to be placed exactly in upper yellow box. Since the background image expands/shrinks (that too differently along x and y), the foreground should also stretch and position itself to fit the yellow box.
Background Image: http://oi52.tinypic.com/2yn5nut.jpg
Foreground Image: http://i52.tinypic.com/dm3503.png
This is my xml file as of now. Pt.(32,47) is the top left corner of top yellow box in background img
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="@drawable/bkgrnd">
<ImageView android:id="@+id/imageView1" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:src="@drawable/foregrnd"
android:scaleType="fitXY" android:layout_marginTop="42px"
android:layout_marginLeft="37px">
</ImageView>
</RelativeLayout>
please tell me about what layout are you using???
according to my understanding i think u have 2 images and u want one as background image and other image as your foreground image. For this you can use the relative layout and set its height and width as "fill_parant" and set your first image as the background of relative layout. using android:background = "firstimage"
and then place the other image view where ever you want.
精彩评论