- How to Change Text Size on Android
- Make text easy to read in seconds
- What to Know
- How Do I Change the Font Size on My Text Messages on Android
- How Do I Change the Size of My Text with Magnification?
- More Ways to Make Text Easier to Read on Android
- Making the most of TextView auto-sizing on Android
- Dynamically adjusting the size of text on Android with a simple API
- When is this needed? 🤔
- The basics 🔤
- Default auto-sizing 1️⃣
- In XML:
- Programmatically:
- Granular auto-sizing 2️⃣
- In XML:
- Programmatically:
- Preset auto-sizing 3️⃣
- In XML:
- Programmatically:
- Pro-tips and gotchas 🤓
- Mixing value types:
- Auto-sizing to a single line:
- Performance:
- Динамическое изменение размера шрифта во всем приложении на Android с помощью Configuration.fontScale
- Первоначальная реализация
- Обновленная реализация
- Android changing text size
How to Change Text Size on Android
Make text easy to read in seconds
What to Know
- Change Android’s text size by going to Settings >Display >Advanced >Font Size. Use the slider to make the text bigger.
- You can also access the font size setting by going to Settings >Accessibility >Font Size.
- Android Magnification feature: Go to Settings >Accessibility >Magnification. Tap the slider to turn it on.
This article will help you change Android’s system-wide text size and offer alternatives to increase the text size further or improve readability.
How Do I Change the Font Size on My Text Messages on Android
If you find it difficult to read text on your Android phone or think that larger text would be more comfortable, there’s good news: it’s easy to change the text size on an Android.
Open the Settings app.
Tap Display.
Tap Advanced, which should be the last option in the Display section.
An expanded list of options will appear. Tap Font Size.
A new screen will appear to show a preview of the font size currently selected. The default is the second smallest of its four available settings. Use the slider at the bottom of this screen to make Android’s text size larger or, if desired, smaller.
The new font size takes effect as soon as you move the slider.
Tap the Back button or return to the Home screen.
You can also access the font size setting through the Accessibility menu: Settings > Accessibility > Font Size.
How Do I Change the Size of My Text with Magnification?
Android’s system-wide magnification tool complements system-wide font size setting is complemented by a.
This feature technically doesn’t increase the font size on your Android device, but it has a similar effect in practice. It can be helpful when the font options don’t meet your needs or aren’t working.
Open the Settings app.
Tap Accessibility.
Tap Magnification.
» data-caption=»» data-expand=»300″ data-tracking-container=»true»/>
A screen will appear with a slider that controls the Magnification feature. Tap it to turn the feature on.
This screen also provides introductions for using the feature.
Once enabled, you can access Magnification by tapping the Accessibility shortcut, an icon of a person, on the Android Navigation Bar.
More Ways to Make Text Easier to Read on Android
Increasing Android’s font size, or magnifying the font, isn’t the only way to make the text easier to read. Several other settings can improve readability even while they don’t increase the size of the font.
Increase display size, which is in the Settings app under both Display and Accessibility. Changing this setting will make some visual elements larger, including icons, and it pairs nicely with changing Android’s font size.
Turn on the dark theme. The dark theme is in the Settings app under Display and Accessibility. Some Android users find dark mode easier to read, while others report it’s less tiring to view for long periods.
Turn on High contrast text, which is under Accessibility. High contrast text will tweak fonts so it appears darker or brighter against its background. However, this is currently an experimental feature, so it may not work in all situations or with all apps.
There’s no feature for printing out text messages built into an Android phone, but some workarounds exist. For example, you can copy and paste the text into a document and print the document. You can also share the text to Google Drive and print it from there.
You can download an app like SMS Backup & Restore to save your text messages. It exports your SMS messages, MMS messages, and call logs. The app can also import a backup you made.
You can try to retrieve that text message you deleted using software like DiskDigger. If you have automatic backup turn on, search for your texts in Google Drive. But, in general, it’s difficult to recover a text once you delete it, as there’s no recycle bin or undo button like on a PC.
Источник
Making the most of TextView auto-sizing on Android
Dynamically adjusting the size of text on Android with a simple API
TextView auto-sizing was introduced to the framework with Android 8.0 Oreo (API 26). It offers a simple yet powerful API to solve a particular problem: scaling of text size to fit text bounds.
When is this needed? 🤔
For Android Development, using a fixed textSize , layout_width=»match_parent” and layout_height=»wrap_content” (perhaps inside a scrollable parent) is fairly common practice and suitable for most TextView use cases.
However, consider the case where the width and/or height of the text bounds are fixed and the text needs to adapt to the available space. Examples include a newspaper-style layout, a font selector that needs to show each different font typeface/name on a single-line, etc. The text can’t scroll and we can’t just add a «read more» button. In these scenarios, TextView auto-sizing is precisely what we need.
The basics 🔤
The TextView auto-sizing API is fairly concise. It can be implemented in XML layouts or programmatically. There are three distinct ways of enabling auto-sizing on a TextView , with increasing levels of specificity: Default, Granular and Preset.
At the time of this writing, the chances of anyone having a minSdk of 26 are quite slim. Thankfully, all of the auto-sizing functionality is available in the AndroidX core package (formerly Support Library). The differences to the framework API are minimal:
- Use the app namespace for XML attributes
- Use the functions in TextViewCompat instead those on TextView directly
Note: All of the examples in this post will use the AndroidX implementation.
Before we get going, there are two important points to keep in mind:
- Auto-sizing (as the name would suggest) only adjusts the text size. Other properties (eg. letterSpacing , lineHeight , etc.) are not changed. They do, of course, affect the text layout bounds and thus impact the automatic size chosen for the text.
- It is advised to not use a layout_width or layout_height of «wrap_content» when using TextView auto-sizing, as this may lead to unexpected results. Using a fixed dimension or «match_parent» is fine (or a “0dp” match_constraint if you are using ConstraintLayout ) .
Default auto-sizing 1️⃣
This is the simplest way of enabling TextView auto-sizing. Given the bounds and attributes of a TextView , the text size is adjusted in an attempt to perfectly fit the horizontal and vertical axes.
Note: The granularity dimensions for default auto-sizing are minTextSize = 12sp, maxTextSize = 112sp, and granularity = 1px (see Granular auto-sizing below).
In XML:
Programmatically:
where autoSizeTextType can be:
- TextViewCompat. AUTO_SIZE_TEXT_TYPE_UNIFORM (enabled)
- TextViewCompat. AUTO_SIZE_TEXT_TYPE_NONE (disabled)
Granular auto-sizing 2️⃣
This allows you to define the values used in uniform auto-sizing: the minimum and maximum text sizes as well a dimension for the size of each «step». A «step» is the increase/decrease in size of the text layout bounds. The text size scales uniformly between the minimum and maximum text size after each «step».
In XML:
Programmatically:
where unit is the TypedValue dimension unit of all of the configuration values (eg. TypedValue. COMPLEX_UNIT_SP ).
Preset auto-sizing 3️⃣
This allows you to specify all the possible values used for auto-sizing. The most appropriate text size will be picked from these values to fit the text bounds.
In XML:
Add the preset sizes to res/values/arrays.xml:
Programmatically:
where unit is the TypedValue dimension unit of the preset size values in the array.
Pro-tips and gotchas 🤓
Mixing value types:
You may have noticed that the programmatic versions of granular and preset auto-sizing could be limiting: the TypedValue unit in these functions applies to all of the supplied auto-sizing values. If you want to mix types (eg. PX and SP) then you need to do so in XML.
Auto-sizing to a single line:
You may be required to restrict auto-sized text to a single line. You can set the lines or maxLines TextView layout attributes to «1» (or use the programmatic equivalent). You may also need to adjust the granular autoSizeMinTextSize , as single-line text will be clipped if the minimum text size is reached but the width still exceeds that of the layout bounds.
Performance:
For performance optimization, one might assume that using preset auto-sizing is the best option. In reality, granular text sizes are precomputed given the minimum, maximum and step values and the difference is negligible.
I hope this post has provided some insight into TextView auto-sizing and how best to make use of it. If you have any questions, thoughts or suggestions then I’d love to hear from you!
Источник
Динамическое изменение размера шрифта во всем приложении на Android с помощью Configuration.fontScale
Доброго времени суток, уважаемые читатели.
Захотелось мне немного поделиться своими мыслями по поводу android разработки. Возникла у меня задача сделать настройку размера шрифта в приложении, чтобы каждый пользователь сам мог подобрать под себя размер.
Изменение размера шрифта решил делать во всем приложении. Но использовать метод setTextSize в каждом activity не вариант, т.к. в один прекрасный момент появится новое поле и придется на нем вновь прописывать нужный размер. Поэтому, решением было сделать автоматическое изменение во всех местах.
Когда писал данную статью, суть заключалась в следующем: в настройках приложения хранится коэффициент увеличения шрифта. Этот коэффициент применяется на реальный размер шрифта в собственном классе, наследованным от TextView. Но Ganster41 подсказал более хорошее решение. Поэтому сперва будет описание первоначального решение, а в конце будет реализация с помощью Configuration.fontScale.
Первоначальная реализация
Естественно new_coef нужно заполнять динамически. Например при выборе значения на бегунке.
Далее этот коэффициент необходимо считать в нужном месте и с помощью него изменять размер шрифта. Каждый раз считывать его из настроек приложения, при активации того или иного TextView, не совсем хорошее решение. Поэтому коэффициент будем считывать один раз при активации приложения и хранить в глобальной переменной. Для этого добавим новый класс приложения:
Обратите внимание на то, что у метода setTextSize первый параметр по умолчанию = TypedValue.COMPLEX_UNIT_SP. Что означает установку размера шрифта в sp единицах измерения. В нашем же случае используется TypedValue.COMPLEX_UNIT_PX. Этот тип необходимо указывать, чтобы задать размер шрифта в пикселях, т.к. getTextSize возвращает текущий размер в пикселях.
В принципе все подготовительные классы готовы. Осталось в нужном месте разметки вместо TextView указать свой собственный класс MyTextView:
В итоге при открытии activity у данного текста будет изменен размер шрифта на тот, что выбрал пользователь. С EditText все делается аналогично.
Обновленная реализация
Для себя я решил использовать коэффициент размера шрифта от 0.7f до 1.45f с интервалом 0.15f. Т.е. это 6 шагов. Для выбора конкретного значения использую SeekBar.
В нужном месте приложения (в методе onCreate) реализуем обработку выбранного значения на SeekBar:
Обработку выбора значения на бегунке сделали. Теперь необходимо сохранить выбранный результат и сразу же изменить размер шрифта (например по кнопке применять):
Теперь при смене activity будет новый размер шрифта во всех местах приложения. Но на данный момент этот размер будет только до перезагрузки приложения. При открытии приложения произойдет установка размера шрифта того, что установлен в настройках android на устройстве. И соответственно, чтобы в приложении был нужным нам размер, необходимо его переназначить. Для этого мы и сохраняем коэффициент в параметры приложения:
По умолчанию используется значение 2, т.е. в моей формуле это коэффициент увеличения шрифта равный 1 (0,7 + 0,15 * 2 = 1). Данный класс необходимо прописать в манифесте:
В итоге при открытии приложения будет изменен размер шрифта во всех местах. Свою реализацию переделал с первого способа на второй, что позволило не добавлять собственные классы для TextView, EditText и т.п.
Источник
Android changing text size
Последнее обновление программы в шапке: 18.08.2021
Краткое описание:
Глобальное изменение размера шрифта в телефоне.
Does the default system font look too small or too large? Do you want to globally change text size?
This app allows you to scale system font size from 50% (smaller) to 300% (bigger).
FEATURES
★ working for Android 2.3 or above devices
★ scale system font size from 50% to 300%
★ preview the scaled text before applying
★ show a notification icon describing the current font size. An option is also provided to hide it
★ switch system font size via tapping the notification
★ customized the scaling value
★ Android 4+ only provides 3 scaling values, we provide more
★ for Android v2.3
3.x users. You can add «not working» apps into the ignored apps list
It may not work for all devices. Please try it and let me know (Settings > App log) if it does not work on your device.
Starting from Android 4.2, this app only works on rooted devices due to Android disables 3rd party apps to change system UI configuration (color, font) unless you are using a rooted phone.
Для работы приложения не требуются рут права. Начиная с Android 4.4 (киткат), изменение размера шрифта происходит только после перезагрузки устройства. Наличие рута и галочка «Рут получен» в настройках приложения дают возможность менять размер без перезагрузки.
версия: 3.09 Pro Сообщение №106, автор Alex0047
версия: 3.08 Pro Сообщение №105, автор Alex0047
версия: 3.07 Pro Сообщение №104, автор Alex0047
версия: 3.05 Pro Сообщение №97, автор Alex0047
версия: 3.04 Pro Сообщение №96, автор Alex0047
версия: 3.03 Pro Big Font (change font size) (Пост Alex0047 #67533472)
версия: 3.02 Pro Big Font (change font size) (Пост Alex0047 #65819453)
версия: 3.01 Pro Big Font (change font size) (Пост Alex0047 #64999746)
версия: 3.00 Pro Big Font (change font size) (Пост Alex0047 #64153528)
версия: 2.83 Pro Big Font (change font size) (Пост Alex0047 #63570546)
версия: 2.82 Pro Big Font (change font size) (Пост Alex0047 #62383395)
версия: 2.81 Pro Big Font (change font size) (Пост Alex0047 #61582894)
версия: 2.80 Pro Big Font (change font size) (Пост Alex0047 #60652271)
версия: 2.79 Pro Big Font (change font size) (Пост Alex0047 #59045641)
версия: 2.78 Pro Big Font (change font size) (Пост Alex0047 #58953106)
версия: 2.77 Pro Big Font (change font size) (Пост Alex0047 #57995536)
версия: 2.76 Pro Big Font (change font size) (Пост Alex0047 #56429084)
версия: 2.75 Pro Big Font (change font size) (Пост Ramzes26 #55438280)
версия: 2.74 Pro Big Font (change font size) (Пост Alex0047 #55278147)
версия: 2.73 Big Font (change font size) (Пост ALEX6301 #53603179)
версия: 2.71 Big Font (change font size) (Пост ALEX6301 #52510231)
версия: 2.70 Big Font (change font size) (Пост ALEX6301 #51104899)
версия: 2.64 Big Font (change font size) (Пост ALEX6301 #50761439)
версия: 2.63 Big Font (change font size) (Пост ALEX6301 #50260183)
версия: 2.62 Big Font (change font size) (Пост ALEX6301 #49573501)
версия: 2.61 Big Font (change font size) (Пост ALEX6301 #49377980)
версия: 2.60 Big Font (change font size) (Пост ALEX6301 #48859981)
версия: 2.59 Big Font (change font size) (Пост ALEX6301 #48292288)
версия: 2.58 ® Big Font (change font size) (Пост ALEX6301 #45657986)
версия: 2.56 ® Big Font (change font size) (Пост Cmapuk XEHK #41240073)
версия: 2.43 ® Big Font (change font size) (Пост #36236636)
версия: 2.42 ® Big Font (change font size) (Пост #35540428)
версия: 2.40 //4pda.to/forum/d…988/Big_Font__2.40.apk
версия: 2.39 //4pda.to/forum/d…7827/Big_Font_2.39.apk
версия: 2.27 //4pda.to/forum/dl/post/3812414/BigFont_2.27.apk
версия: 2.23 Big_Font_change_font_size_2_23.apk ( 1.06 МБ )
Сообщение отредактировал iMiKED — 18.08.21, 05:23
Версия 2.26
— fixed: failed to show «Function guide» on Android 4.3+ devices
— bugs fixed
===
Русского нет. Требования ОС: 2.3.3+
Источник