i have image-view in my xml for setting the image over a background image at a specified place of back ground image i set it for one emulator and it works but when i launch other emulator of different size image-view change it corresponding p开发者_StackOverflowosition with respect to background image so how to set image view over a background image so that imageview not changes its position for any size of screen i am providing my code ...thanks in advance..
here is my splash.xml file ,button and imageview changes its position w.r.t. background image..for diffrent size screen emulator
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/TheSplashLayout"
android:layout_gravity="center"
android:background="@drawable/splashmodified"
>
<ImageView
android:layout_width="60sp"
android:layout_height="60sp"
android:id="@+id/SplashImageView"
android:layout_gravity="center"
android:layout_marginTop="120sp"
android:layout_marginLeft="55sp"
/>
<Button
android:text="SUBMIT"
android:id="@+id/submitt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="75px"
android:layout_marginTop="300px"
/>
</RelativeLayout>
Did not understand the question, you might consider uploading some images and giving us links to them. Only thing I can tell is that you must avoid using px
when indicating any dimensions. This will make your views look different on every device, that you probably don't want.
use dip
instead of px
and sp
.
Your xml will be
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/TheSplashLayout"
android:layout_gravity="center"
android:background="@drawable/splashmodified"
>
<ImageView
android:layout_width="60dip"
android:layout_height="60dip"
android:id="@+id/SplashImageView"
android:layout_marginTop="120dip"
android:layout_marginLeft="55dip"
android:background="@drawable/a_thumb"
/>
<Button
android:text="SUBMIT"
android:id="@+id/submitt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="75dip"
android:layout_marginTop="300dip"
/>
</RelativeLayout>
Thanks Deepak
精彩评论