Android的UI设计:支持多个屏幕多个、屏幕、Android、UI

2023-09-12 23:38:10 作者:眷恋、不如相见

我已阅读本教程支持多屏幕操作多次和许多计算器问题,关于设计Android的用户界面与所有的Andr​​oid屏幕尺寸合身。

I have read this tutorial SUPPORTING MULTIPLE SCREENS several times and many stackoverflow questions regarding Design Android UIs to fit well with all android screen sizes.

但随着提供最好的和相同的用户体验,所有的屏幕尺寸同样还在挣扎。

But still struggling with providing the best and the same user experience for all screen sizes equally.

在我设计的界面始终保持下图的初衷。

When I am designing the Interfaces always keeping the following diagram in mind.

有关的那一刻我的应用程序,它使用下的资源文件夹下面的文件夹结构。

For the moment in my app it uses following folder structure under the res folder.

此外,我已经使用的 DP 和 SP 定义的大小,当单位在XML布局文件。

Also I have used dp and sp units in the xml layout files when defining the sizes.

小屏幕尺寸

当谈到小的屏幕尺寸也完全指根据定义的用户界面布局小键,显示没有任何问题。

When it comes to small screen sizes it perfectly refer to the UIs defined under layout-small and display without any issue.

普通屏幕尺寸

在我设计布局进行正常的屏幕尺寸(布局文件夹),我用3.5英寸 Android设备和3.7英寸模拟器测试用户界面怎么看起来像普通的屏幕尺寸。

When I design layouts for normal screen sizes(layout folder), I used 3.5 inches android device and 3.7 inches emulator to test how UI looks like in normal screen size.

所以,我的布局看起来优秀的在这大小,但三星Gallaxy S3(4.8英寸)和S4(5.0英寸 )有稍微大一点的屏幕,他们仍然指的是普通屏幕大小的布局。因此,在那些更大的屏幕已经从底部没有使用和用户界面看起来并不好看留下了相当大的空间。

So my layouts look excellent in this size but Samsung Gallaxy S3 (4.8 inches) and S4 (5.0 inches) having slightly bigger screens and they still refer to the normal screen sized layouts. Therefore in Those bigger screens have a considerable space left from the bottom not using and UI doesn't look nice.

另外,在清单文件,我已经definied以下几点,

Also In the manifest file, I have definied the followings,

<uses-sdk
    android:minSdkVersion="4"
    android:targetSdkVersion="17" />

<supports-screens 
    android:largeScreens="true" 
    android:normalScreens="true" 
    android:smallScreens="true" 
    android:anyDensity="true" />

我有图像浓度没有问题的(绘制-HDPI /绘制-xhdpi /绘制-MDPI /绘制-LDPI

(1)。神奇我丢失或做错了会导致这样的特意在更大的屏幕(4.8英寸),是指正常的布局是什么。

(1). Wonder what I am missing or doing wrong to result like this specially in Bigger screens (4.8 inches) to refer normal layouts.

(2)。同时如果有人可以解释最佳实践和 RES 文件夹下定义的文件夹结构得到吨适合的标准方法很好地与所有的屏幕尺寸在Android中,将不胜感激,因为这是如此混乱。谢谢。

(2). Also If someone can explain best practices and the standard way of defining folder structure under the Res folder to get t fit well with all the screen sizes in android, would be grateful as this is so confusing. Thanks.

推荐答案

您可以使用社民党大小单位,是相对于屏幕的大小。

Instead of using the dp size unit you can use the sdp size unit that is relative to the screen size.

使用的SDP大小单位你将不得不在所有的屏幕尺寸相同的用户体验,只有一个布局XML。

Using the sdp size unit you will have the same user experience on all screen sizes with only one layout xml.

小心使用!例如,在大多数情况下,你仍然需要设计不同的布局为平板电脑。

Use it carefully! for example, in most cases you still need to design a different layout for tablets.