我在我的xml中有图像视图,用于在背景图像的指定位置设置背景图像的图像,我将其设置为一个模拟器并且它可以工作,但是当我启动其他不同大小的图像视图模拟器改变它相对于背景图像的相应位置,所以如何在背景图像上设置图像视图,以便imageview不会改变其对于任何大小屏幕的位置 我正在提供我的代码...在此先感谢..在背景图像上设置图像的问题android
这里是我的splash.xml文件,按钮和imageview改变其位置wrt背景image..for不同势尺寸屏幕模拟器
<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>
那么我应该在PX的plase使用?如果我在的地方像素的则也问题不解决.. – 2011-06-14 06:47:59
使用SP @ saurabh,你应该使用'dp'(密度独立像素)而不是'px':http://stackoverflow.com/questions/2025282/difference-of-px-dp-dip-and-sp-in-android – sfat 2011-06-14 06:50:06
您可以使用dp,sp或dip。你可以看看这篇文章,以便说清楚: http://developer.android.com/guide/topics/resources/more-resources.html#Dimension – Egor 2011-06-14 06:50:39