您好,我已经在 xml 中制作了用于显示的 UI,它在 480*800 分辨率尺寸的屏幕上看起来不错,但对于 320*480 或中等尺寸的小尺寸屏幕,UI 看起来失真意味着按钮不在其真实位置。我保存ldpi、hdpi 和 mdpi 文件夹中的所有图像,并授予屏幕支持权限
下面是我的xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/mainmenuimage"
>
<Button android:layout_marginTop="230dip"
android:text="currentloc"
android:focusable="true"
android:background="@drawable/mainmenubtn"
android:id="@+id/btn" android:layout_height="50dip"
android:layout_width="110dip"
android:layout_marginLeft="100dip"/>
<Button
android:text="Filter"
android:id="@+id/filter"
android:layout_height="50dip"
android:layout_width="110dip"
android:layout_marginLeft="100dip"
android:layout_marginTop="6dip"
android:background="@drawable/mainmenubtn"/>
<Button
android:text="keyword search"
android:id="@+id/keysearch"
android:layout_height="50dip"
android:layout_width="110dip"
android:layout_marginLeft="100dip"
android:layout_marginTop="6dip"
android:background="@drawable/mainmenubtn"/>
</LinearLayout>
list 是:
<supports-screens
android:anyDensity = "false"
android:resizeable="true"
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
/>
所以如何处理不同屏幕的布局,我已经阅读了 alreday 在 android 开发人员方面的所有教程....但没有任何......请帮忙谢谢
最佳答案
这篇文章描述了要做什么: http://developer.android.com/guide/practices/screens_support.html
For example, the following is a list of resource directories in an application that provides different layout designs for different screen sizes and different bitmap drawables for medium, high, and extra high density screens.
res/layout/my_layout.xml // layout for normal screen size
res/layout-small/my_layout.xml // layout for small
res/layout-large/my_layout.xml // layout for large
res/layout-xlarge/my_layout.xml // layout for extra
res/layout-xlarge-land/my_layout.xml // layout for extra large in landscape orientation
res/drawable-mdpi/my_icon.png // bitmap for medium density
res/drawable-hdpi/my_icon.png // bitmap for high density
res/drawable-xhdpi/my_icon.png // bitmap for extra high density
关于android - 如何处理 diffrent-2 屏幕分辨率 android 的 xml UI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7453748/