Android的SP VS DP文本 - 你会调整“尺度”,什么是支撑的理念 [英] Android sp vs dp texts - what would adjust the 'scale' and what is the philosophy of support

查看:189
本文介绍了Android的SP VS DP文本 - 你会调整“尺度”,什么是支撑的理念的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此​​,我们知道从我们要用SP,而不是DP在Android的文字很多其他职位,我们也知道这样做的原因是为了尊重'用户的preferences'。

So we know from many other posts that we should use sp rather than dp for text in Android, and we know the reason for this is to respect a 'user's preferences'.

不过,precisely这些是什么preferences? 怎么可能一个用户更改此设置?

But precisely what are these preferences? How might a user change this setting?

我找不到通过我的手机上设置任何参考(我本来期望的东西在辅助功能或显示)。那么,什么是用户设置?难道只有通过一个应用程序的喜欢,如大字体?

I cannot find any reference through the settings on my phone (I would have expected something in 'Accessibility' or 'Display'). So what is a user setting? Is it only done through the likes of an app such as 'Big Font'?

假设它是(通过类似大字体设置) - 我已经打了谷歌文档和字体设置为130%,其他谷歌应用程序。虽然大多数布局保持优良,一些变得有点切断且不​​能读取(即上一个大的筛选SGS2)。那么,什么是方法,使用SP发展与文本的大小应用程序?难道我们要确保它适用于100%的缩放,然后忽略其他设置 - 把它称为一个特殊情况,用户可担心的,还是我们走出去我们的方式,以确保事情扩大或正在滚动,如果文本溢出?

Assuming that it is (set by something like big font) - I have played with Google Docs and some other Google apps with the font set to 130%. While most layout stays fine, some gets a bit cut off and can't be read (and that is on a big screened SGS2). So, what is the approach to developing apps with text sizes using 'sp'? Do we make sure it works on 100% scaling and then ignore other settings - call it a special case that the user can worry about, or do we go out of our way to make sure things expand or are scrollable, in case the text overflows?

一种观点认为,我们应该用'DP'来的保证的用户已经看到的文字(即使它们不得不使用放大镜)的机会

One argument is that we should use 'dp' to guarantee a user has a chance of seeing the text (even if they have to use a magnifying glass)

思想/评论?

推荐答案

这是在一些Android设备的设置菜单曝光(制造商而定)。它也可以由一些辅助功能选项(设备相关)改变的

It is exposed in the settings menu on some Android devices (manufacturer dependent). It may also be altered by some accessibility options (device-dependent).

在一般情况下,你应该总是使用与尺度无关像素,尤其是对大段文字。

In general, you should always used scale-independent pixels, especially for a large body of text.

然而,如果你的文本必须适应一个包围盒已知大小,那么你应该使用密度无关的像素,以确保文本总是适合正常,所有字符都可见无论用户设置的。

However if your text has to fit into a bounding-box of known size then you should use density independent pixels in order to ensure that the text always fits properly and that all characters are visible regardless of the users' setting.

在一言以蔽之:将增加文字大小约5SP导致文本不可读或裂伤你的用户界面?如果是这样的使用密度无关的像素。如果没有,使用独立的规模像素。然而,你通常应该打算使用独立的规模像素只要有可能,这意味着设计的用户界面,可容纳不同大小的文字

In a nutshell: would increasing the text-size by around 5sp result in the text being unreadable or mangle your UI? If so use density-independent pixels. If not, use scale-independent pixels. However you should generally aim to use scale-independent pixels wherever possible, which means designing a UI that can accommodate different text sizes.

这篇关于Android的SP VS DP文本 - 你会调整“尺度”,什么是支撑的理念的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆