-
Notifications
You must be signed in to change notification settings - Fork 743
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Accessibility Scaling Doesn't Work (Android) #19056
Comments
Thanks for the report. Font scaling is implemented here: uno/src/Uno.UI/Controls/PaintPool.Android.cs Line 153 in 13630a7
which gets its values from here:
and
it may be that some android devices don't provide that value properly, or that a change in android broke this feature. Can you try calling the
does not get called when the system size changes. |
I can confirm stopping and restarting the app picks up the new scale value. I overrode public class MainActivity : Microsoft.UI.Xaml.ApplicationActivity
{
public override void OnConfigurationChanged(Configuration newConfig)
{
base.OnConfigurationChanged(newConfig);
ViewHelper.RefreshFontScale();
}
} It's definitely getting called by Android (stops at a break point) so The newConfig object's .fontScale property reads 1.29999995 at the +2 notch on the scale (cf 1.0 at the default) so this detail is available to the app. Adding some additional debugging to investigate public class MainActivity : Microsoft.UI.Xaml.ApplicationActivity
{
public override void OnConfigurationChanged(Configuration newConfig)
{
base.OnConfigurationChanged(newConfig);
ViewHelper.RefreshFontScale();
// display metrics
using Android.Util.DisplayMetrics displayMetrics = Android.App.Application.Context.Resources.DisplayMetrics;
var debugScaledDensity = displayMetrics.ScaledDensity;
var debugDensity = displayMetrics.Density;
var debugConfig = FeatureConfiguration.Font.IgnoreTextScaleFactor;
var debugConfigMaxScale = FeatureConfiguration.Font.MaximumTextScaleFactor;
return;
}
}
So It looks like the UI isn't redrawing itself in response to these changes. Side note: There is a note in the Android docs indicating that the |
Current behavior
Despite the documentation stating that Uno automatically scales text in response to accessibility configuration on Android and iOS. This is not happening on either the emulator or test device I am using.
I added the inverse of the disabling code linked above just in case it's now disabled by default to the app constructor to enable text scaling but it had no effect on observed behaviour.
Screenshots
At default text size:
At +2 text size:
Expected behavior
Displayed text should change size in response to accessibility configuration made in platform settings.
How to reproduce it (as minimally and precisely as possible)
Steps to reproduce:
created a new app from template.
build & deployed to Android Emulator (API level 35).
switched to Settings > Display Size and text.
adjusted Font Size slider to two places larger from the default.
switched back to the app.
there was no change in the displayed text.
switched to app drawer to confirm OS had changed it's default text size. It had.
deployed to device at API level 33 & it exhibited the same behaviour.
Demo project
UnoAppTest.zip
Workaround
N/A
Works on UWP/WinUI
None
Environment
No response
NuGet package version(s)
N/A
Affected platforms
Android
IDE
Rider Windows
IDE version
JetBrains Rider 2024.3 (Build #RD-243.21565.191)
Relevant plugins
Runtime version: 21.0.5+8-b631.16 amd64 (JCEF 122.1.9)
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Toolkit: sun.awt.windows.WToolkit
Windows 11.0
.NET Core v8.0.4 x64 (Server GC)
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Memory: 2048M
Cores: 16
Registry:
ide.experimental.ui=true
i18n.locale=
Non-Bundled Plugins:
com.intellij.resharper.HeapAllocationsViewer (2024.3.0)
com.jetbrains.rider.android (243.21565.191)
unoplatform (1.2.28)
Anything else we need to know?
N / A
The text was updated successfully, but these errors were encountered: