如何使应用程序中的字体大小不受更改设置字体大小的影响

编程入门 行业动态 更新时间:2024-10-27 02:20:07
本文介绍了如何使应用程序中的字体大小不受更改设置字体大小的影响的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

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

更多推荐

如何使应用程序中的字体大小不受更改设置字体大小的影响

本文发布于:2023-10-07 01:29:33,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1468055.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字体大小   不受   应用程序

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!