如何更改字体大小在整个应用程序编程,机器人?字体大小、机器人、应用程序、如何更改

2023-09-12 23:48:04 作者:烟酒嗓

我已经创建了微调与字体大小,从8到46的名单。我可以点击字体大小,并在微调它已表现出了我。

I have created Spinner with the list of Font Sizes from "8" to "46" . I could be able to click the font Size and in a spinner it has shown me .

我需要的是,如果我点击字体大小里面微调26,那么它​​应该被应用到我的整个项目。就像适用于我的屏幕,TextView的外观,EDITTEXT - 粗体/斜体等,再次,如果我按一下46的大小,那么它应该是适用于我的整个项目

My need is, if i click the Font Size "26" inside a Spinner then it should be applied to my whole project. Like applying to my Screen, Textview appearance, Edittext - Bold/ Italic, etc. Again if i click 46 size then it should be apply to my whole project.

我怎么能做到这一点通过编程方式?

How could i do this by programmatically ?

推荐答案

在可能的解决方案将是您创建一个基类其中扩展的TextView ,然后使用该文本视图类编辑文本。希望你所要求的大小在第一个屏幕。在任何情况下,u盘在基类文本大小。这将解决您的问题。

The probable solution would be you create a base class which extends TextView, and use this text view class as edit text. Hope you are asking for size in first screen. In any case, u set the text size in the base class. This will solve your problem.

像你创建该类的包com.example和类名是BaseTextView,然后在XML文件,而不是< TextView的... /> 你会写< com.example.BaseTextView ... />

like u create this class in package com.example and class name is BaseTextView, then in xml file instead of <TextView .../> you will write <com.example.BaseTextView ... />

希望这有助于。