【发布时间】:2016-05-31 11:00:36
【问题描述】:
我的布局有问题,当我查看不同的屏幕尺寸时,我的 imageview 和 imagebutton 似乎没有保持原位!就像在 5.4 英寸 480x584 屏幕上一样,imageview 不会保持位置并朝顶部移动!我尝试的是为这个屏幕尺寸创建一个布局文件夹 sw360dp,当我查看所有屏幕时,它仍然给我其他设备屏幕上的问题!我已经阅读了开发人员文档,但仍然无法解决这个问题!,我已经包含了我的 xml 布局。谢谢
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/cropdream1">
<ImageView
android:src="@drawable/newbts"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:layout_marginTop="82dp"
android:id="@+id/imageView2" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/rsz_win"
android:layout_below="@+id/imageView2"
android:layout_centerHorizontal="true"
android:layout_marginTop="104dp" />
</RelativeLayout>
【问题讨论】:
-
请查看this answer
-
感谢您的回复,但不是我想要的,我已经从您提供的链接中获得了这些布局,但不推荐使用 layout-large 等,因此平板电脑应为 sw600dp,小型手机等应为 sw360dp等等,我遇到的问题是图像视图和图像按钮在选择不同的屏幕预览时在设计器布局中移动
标签: xml android-studio android-imageview android-xml