如何使应用程序中的字体大小不受更改设置字体大小的影响 [英] How to make font sizes in app to not get effected by changing Settings Font size

查看:82
本文介绍了如何使应用程序中的字体大小不受更改设置字体大小的影响的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当设置->显示->字体大小上的字体大小为正常"时,我的应用程序按照设计运行良好.

I have my app running well as per design when the font size is at "Normal" on Settings->Display->FontSize.

当我将字体大小更改为小/大时,整个内容都被混搭了.我的应用程序是内容密集型的,这对应用程序产生了严重影响.

When i change the font size to Small/Large entire content is mashed up. My app is content intensive and this is badly effecting the app.

可以说,操作栏标题就像隐私和设置".当字体大小在系统设置中设置为大"时,标题会超出边界/椭圆大小.列表视图内容看起来很可悲.

Lets say, action bar title is like "Privacy and Settings". The title runs off the bounds/ellipsizes when font size is set to "Large" in System Settings. The listview contents look pathetic.

有没有办法确保设置->字体中的更改不会影响我们的应用程序?

Is there a way to make sure that the change in Settings->Fonts doesn't effect our app?

Flipboard 应用可以做到这一点.

Flipboard app does that.

推荐答案

我终于找到了解决方案.Google 严格建议对字体使用sp".但是,如果您不想根据用户字体设置缩放文本,请使用dp".如果您转到设置->字体,则给定设备中的字体大小不会改变.您的 UI 将保持您的设计初衷.

I finally got the solution. Google strictly recommends to use "sp" for fonts. However, if you do not want the text to be scaled based on user font settings, use "dp". The font size will not change in a given device if you go to settings->fonts. Your UI will remain just like you designed it for.

感谢 Aswin 的投入.感谢 Joseph Earl 在 Android sp 与 dp 文本 - 什么会调整比例"以及支持的理念是什么

Thanks Aswin for your inputs. And thanks to Joseph Earl for answering question at Android sp vs dp texts - what would adjust the 'scale' and what is the philosophy of support

这篇关于如何使应用程序中的字体大小不受更改设置字体大小的影响的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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