Android 安卓布局在一个小设备上
我正在为android开发一个应用程序。我的主要布局是一个相对的布局 当我在大屏幕模拟器中打开应用程序进行调试时,一切正常。 但当我在QVGA设备上打开它时,我看到所有的布局都扭曲了 我真的需要为每个屏幕大小制作一个新的布局吗?我在一些地方看到android可以自动扩展所有内容以适应布局 Developer.android.com说: 默认情况下,Android会调整应用程序布局以适应当前设备屏幕 () 你能帮我弄清楚为什么一个布局在一个小设备上看起来会扭曲吗? 正如您所看到的,图像确实被拉伸了,但是布局没有很好地显示出来 提前谢谢 编辑:问题页面的XML代码。 所有的图形都在“drawable hdpi”文件夹中,但问题不在于图像本身,而在于布局Android 安卓布局在一个小设备上,android,image,layout,stretch,Android,Image,Layout,Stretch,我正在为android开发一个应用程序。我的主要布局是一个相对的布局 当我在大屏幕模拟器中打开应用程序进行调试时,一切正常。 但当我在QVGA设备上打开它时,我看到所有的布局都扭曲了 我真的需要为每个屏幕大小制作一个新的布局吗?我在一些地方看到android可以自动扩展所有内容以适应布局 Developer.android.com说: 默认情况下,Android会调整应用程序布局以适应当前设备屏幕 () 你能帮我弄清楚为什么一个布局在一个小设备上看起来会扭曲吗? 正如您所看到的,图像确实被拉伸了
<?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>
我真的需要为每个屏幕大小制作一个新的布局吗
当现有布局不起作用时,您需要创建新布局,并且您选择创建新布局,而不是以其他方式解决问题
你能帮我弄清楚为什么一个布局在一个小设备上看起来会扭曲吗
您的布局非常好,因为它完全按照您的要求进行:
- 视频按钮位于布局底部上方42dp
- “或”线位于视频按钮上方19dp处
- 音频按钮位于“或”线上方22dp
- 为
设备或-小型
- 使用维度资源而不是硬编码的值,并对
-小型设备或