我正在开发一个针对android的应用程序。我的主布局是一个RelativeLayout。安卓版面在一个小设备上被拉伸了
当我在大屏幕模拟器中打开应用程序进行调试时,一切正常。 但是当我在QVGA设备上打开它时,我发现布局失真。
我是否真的需要为每个屏幕尺寸制作新的布局?我已经看到在一些地方是机器人可以自动伸展一切以适应布局...
Developer.android.com说:
默认情况下,Android的重新调整你的应用程序布局,以适应当前设备屏幕。
(http://developer.android.com/guide/practices/screens_support.html)
能否请你帮我弄清楚为什么布局看起来扭曲离子的小型设备? 正如您所看到的那样,图像确实会拉伸,但布局显示效果不佳。
在此先感谢!
Big Screen Image http://www.interload.co.il/upload/6549026.png Small Screen Image http://www.interload.co.il/upload/9617759.png
编辑:存在问题的网页 XML代码。 所有图形都在“drawable-hdpi”文件夹中,但问题不在于图像本身,而在于布局。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background" xmlns:android1="http://schemas.android.com/apk/res/android">
<ImageView
android:id="@+id/selectionHead"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="@drawable/header" />
<ImageView
android:id="@+id/chooseFormatTxt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/selectionHead"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:src="@drawable/step1_choose_format" />
<ImageView
android:id="@+id/videoBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="42dp"
android:onClick="VideoClick"
android:src="@drawable/step1_video" />
<ImageView
android:id="@+id/orTxt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/videoBtn"
android:layout_centerHorizontal="true"
android:layout_marginBottom="19dp"
android:src="@drawable/step1_or" />
<ImageView
android:id="@+id/audioBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/orTxt"
android:layout_alignLeft="@+id/videoBtn"
android:layout_marginBottom="22dp"
android:layout_centerHorizontal="true"
android:onClick="AudioClick"
android:src="@drawable/step1_audio" />
<ImageView
android1:id="@+id/step1Share"
android1:layout_width="wrap_content"
android1:layout_height="wrap_content"
android1:layout_alignBottom="@+id/selectionHead"
android1:layout_alignParentRight="true"
android:layout_marginBottom="10dp"
android:layout_marginRight="5dp"
android1:src="@drawable/share" />
</RelativeLayout>
你有硬编码的图像位置的布局,多数民众赞成Ÿ它的外观不同的行为。 – 2012-04-01 12:46:58
没有足够的信息在这里给出 - 发表您的布局XML,让我们知道什么文件夹(或多个)您可绘制在 – areyling 2012-04-01 13:39:16
尝试更加具体,当你永远有任何查询,并尽量提供您的问题 – Ishu 2012-04-01 13:58:54