[英]problem in setting image over a background image android
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 position 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..我在我的 xml 中有图像视图,用于在背景图像的指定位置将图像设置在背景图像上关于背景图像,因此如何在背景图像上设置图像视图,以便 imageview 不会针对任何尺寸的屏幕更改其 position 我正在提供我的代码...提前谢谢..
here is my splash.xml file,button and imageview changes its position w.r.t.这是我的飞溅。xml文件,按钮和 imageview 更改其 position w.Z4B43B0AEE.5624DC281ZB9B。 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.我唯一能说的是,在指示任何尺寸时必须避免使用
px
。 This will make your views look different on every device, that you probably don't want.这将使您的视图在每台设备上看起来都不同,这是您可能不想要的。
use dip
instead of px
and sp
.使用
dip
代替px
和sp
。
Your xml will be您的 xml 将是
<?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谢谢迪帕克
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.