Android 预缩放并支持不同大小的屏幕

Android 预缩放并支持不同大小的屏幕,android,screen,screen-resolution,Android,Screen,Screen Resolution,我正在通读并试图理解预缩放是如何工作的 我有以下为galaxy选项卡优化的布局文件: <?xml version="1.0" encoding="UTF-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/relativelayoutmain" android:orientation="vertical" android:layout_w

我正在通读并试图理解预缩放是如何工作的

我有以下为galaxy选项卡优化的布局文件:

<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativelayoutmain"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/mainmenu"
>
<ImageButton
android:id="@+id/start_button"
android:layout_marginLeft="150dip"
android:layout_marginTop ="70dip"
android:layout_width="500dip"
android:layout_height="214dip"
android:background="@drawable/startsession"
android:contentDescription="@string/descbuttonstart"
/>

我已将屏幕的图像放在可绘制的ldpi文件夹中。问题是,当我在一个较小的屏幕上测试应用程序时(使用模拟器),屏幕不能正确缩放-按钮太大,位置不正确

是否有可能只为所有屏幕设置一个布局文件?如果有,那么实现这一点的秘诀是什么


谢谢。

屏幕大小和屏幕分辨率是两个独立的东西。ldpi文件夹中的资源用于低分辨率,不需要小屏幕。我更喜欢的方式是定义高分辨率的资源,并让它们在其他资源上缩小规模。

不,恐怕不可能您需要有三个不同的文件夹(hdpi、mdpi、ldpi),它们的按钮、图像等具有不同的尺寸
同样对于布局,您需要有三个布局文件夹(小布局、中布局、大布局)

谢谢-所以我应该为每个屏幕大小设计一个单独的布局文件?