gpt4 book ai didi

Android 设计布局是否带软按钮

转载 作者:行者123 更新时间:2023-11-29 20:56:23 25 4
gpt4 key购买 nike

总的来说,我对 Android 开发还很陌生。现在我们有一个 UI 设计师可以说在 photoshop 中提供了一个 720x1280 (xhdpi) 模板的 UI 设计。然后我以像素为单位进行测量,然后将它们除以 2 以将其带回 mdpi。

当我在没有软按钮的手机上运行该应用程序时,它与 UI 设计师提供的设计完美匹配。

但是当应用程序在具有软按钮的手机(如 HTC m8)上运行时,软按钮会隐藏应用程序的底部。

有没有办法解决这个问题?

设计师应该做2个UI设计吗? 1个没有软键和1个没有软键?然后在我的应用程序中我应该检测使用哪个 UI?还有比这更好的解决方案吗?

这是我的问题的一个例子:

所以左边是 UI 设计,中间是在没有软按钮的手机上运行,​​右边是在有软按钮的手机上运行。

enter image description here

如果你有兴趣,这里是xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<View
android:layout_width="match_parent"
android:layout_height="450dp"
android:background="@android:color/holo_blue_dark">

</View>
<View
android:layout_width="match_parent"
android:layout_height="116dp"
android:padding="10dp"
android:background="@android:color/holo_red_dark">

</View>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@android:color/holo_blue_dark">

</View>

感谢任何帮助,

最佳答案

Now we have a UI designer who lets say provided a UI design in photoshop with a template of 720x1280 (xhdpi)

首先,720x1280 与 xhdpi 无关。密度与屏幕分辨率无关。

其次,并非所有 Android 设备的屏幕分辨率都是 720x1280,甚至是 16:9 的宽高比。

But when the app is ran on phone that have the soft buttons, like the HTC m8, the soft buttons hides the bottom of the app.

让我们从网站的角度来考虑这个问题。您所说的等同于说您正在尝试设计一个支持 720x1280 的网站,如果用户胆敢使用不同大小的浏览器窗口,则该网站将不起作用。

这将被大多数人认为是有缺陷的设计,或者可能是有缺陷的设计的有缺陷的实现。

Web 设计人员和开发人员应该精通响应式设计的概念,使用流畅的布局等来利用可用的浏览器窗口空间。

移动应用开发也不异常(exception)

欢迎设计师为 720x1280 分辨率屏幕制作 UI 模型或线框。但是,设计人员需要围绕可能的屏幕尺寸范围进行设计(更不用说纵向与横向)。因此设计师需要指定布局规则,而不仅仅是创建模型。这些规则需要考虑不同的屏幕尺寸,以英寸或与密度无关的像素(Android 中的 dp,相当于 Web 开发人员的 CSS 像素)为单位测量,而不是硬件像素。

Is there a way to fix this issue?

让设计师为布局提供实际规则,主要使用模型作为描述这些规则实现的工具。然后你的工作就是解释这些规则并使用内置容器对它们进行编码(例如,LinearLayoutRelativeLayoutTableLayout GridLayout) 或您自己的自定义 ViewGroups(根据需要)。

Should the designer make 2 UI design?

设计人员应该制作一个设计,但可能需要一些模型,以帮助解释该设计如何响应不同的屏幕尺寸和方向。

关于Android 设计布局是否带软按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27581013/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com