I am using relative layout to superimpose one smaller image on top of a larger one. I want the bottom-right corner of the smaller image to coincide with B-R corner of the larger image. Im using margin parameters in my layout xml (specifying measurement in dips) but this doesnt seem to work for all devices and resolutions - in some cases the small image is shifted by 4-5px from the border.
Is it possible to specify the position of the smaller image without pixel values?? Ie with gravity or something??
Nice thing about
RelativeLayout
is that you can use relative positions and dimensions, instead of using specific dips or pixels. In the case above, I just played with theandroid:layout_align*
parameters, to make sure that both images are aligned. Keep in mind that I set a specific dimension of the little image, but you can change that to fit your needs.