SalentoFC Member Licensed User Longtime User Dec 28, 2014 #1 Hi guys, I'd like to know why on some devices the autoscale of txtbox is ok (ex s3 and s4) but on phones of my parents (note II and Vodafone cell) resolution of txtbox is not ok. I'll attach 2 same screenshots (first ok on my s3 and second not ok on note 2) naturally relatives to 1 posto. See both pictures and notate differences. Tks everybody. If you like watching my app is avaible on google play store as name of "Storic Memory Game arma carabinieri" and download it. tks for helping Attachments Screenshot_2014-12-15-05-56-24.png 262.7 KB · Views: 479 IMG-20141228-WA0011.jpg 164 KB · Views: 387 Last edited: Dec 28, 2014
Hi guys, I'd like to know why on some devices the autoscale of txtbox is ok (ex s3 and s4) but on phones of my parents (note II and Vodafone cell) resolution of txtbox is not ok. I'll attach 2 same screenshots (first ok on my s3 and second not ok on note 2) naturally relatives to 1 posto. See both pictures and notate differences. Tks everybody. If you like watching my app is avaible on google play store as name of "Storic Memory Game arma carabinieri" and download it. tks for helping
LucaMs Expert Licensed User Longtime User Dec 28, 2014 #3 It could also be a problem of device settings. I never modify them, but I remember that you can select the "font size". Upvote 0
It could also be a problem of device settings. I never modify them, but I remember that you can select the "font size".
LucaMs Expert Licensed User Longtime User Dec 28, 2014 #4 Settings - Accessibility - Large Text Impostazioni - Accesso facilitato - Testo grande. We can search on site how to get this info by code Upvote 0
Settings - Accessibility - Large Text Impostazioni - Accesso facilitato - Testo grande. We can search on site how to get this info by code
LucaMs Expert Licensed User Longtime User Dec 28, 2014 #5 Found this (Web): if Large Text is set, android changes the font scale , so you can detect using Code: Configuration c = getResources().getConfiguration(); float scale = c.fontScale; if scale is greater than 1 then it is large text. now we need to "translate" it to b4a! Probably a JavaObject can be enough Upvote 0
Found this (Web): if Large Text is set, android changes the font scale , so you can detect using Code: Configuration c = getResources().getConfiguration(); float scale = c.fontScale; if scale is greater than 1 then it is large text. now we need to "translate" it to b4a! Probably a JavaObject can be enough
LucaMs Expert Licensed User Longtime User Dec 28, 2014 #6 Code: Sub LargeTextSet As Boolean Dim r As Reflector r.Target = r.GetContext r.Target = r.RunMethod("getResources") r.Target = r.RunMethod("getConfiguration") Dim Sc As Float = r.GetField("fontScale") Return (Sc > 1) End Sub This should work (wow, my first code with reflection, if I remember correctly!). So if the function returns True you will have to adapt the font size. Upvote 0
Code: Sub LargeTextSet As Boolean Dim r As Reflector r.Target = r.GetContext r.Target = r.RunMethod("getResources") r.Target = r.RunMethod("getConfiguration") Dim Sc As Float = r.GetField("fontScale") Return (Sc > 1) End Sub This should work (wow, my first code with reflection, if I remember correctly!). So if the function returns True you will have to adapt the font size.
SalentoFC Member Licensed User Longtime User Dec 29, 2014 #7 Then if Sc > 1 how can I set it to 1? Or I can't do.this? I just used autoscale in my code Upvote 0
LucaMs Expert Licensed User Longtime User Dec 29, 2014 #8 I don't know if you can change that user setting (and maybe it would not be correct, unless you can then set it as it was). Unfortunately, I see no other possibility that multiply all textsize to a decimal value less than 1, if that setting is set to "Large Text". Upvote 0
I don't know if you can change that user setting (and maybe it would not be correct, unless you can then set it as it was). Unfortunately, I see no other possibility that multiply all textsize to a decimal value less than 1, if that setting is set to "Large Text".
LucaMs Expert Licensed User Longtime User Dec 29, 2014 #9 Now I search if you can set that option by code. Otherwise, you can check the setting and possibly put a message like: "for better viewing, please uncheck ... etc" Upvote 0
Now I search if you can set that option by code. Otherwise, you can check the setting and possibly put a message like: "for better viewing, please uncheck ... etc"
LucaMs Expert Licensed User Longtime User Dec 29, 2014 #10 Probably you can set it using: r.SetField("fontScale", "0.8", "java.lang.float") (I have not tried) Upvote 0
LucaMs Expert Licensed User Longtime User Dec 29, 2014 #11 LucaMs said: Probably you can set it using: r.SetField("fontScale", "0.8", "java.lang.float") (I have not tried) Click to expand... No, it does not work (maybe it's a read-only value). Erel, help please Upvote 0
LucaMs said: Probably you can set it using: r.SetField("fontScale", "0.8", "java.lang.float") (I have not tried) Click to expand... No, it does not work (maybe it's a read-only value). Erel, help please
LucaMs Expert Licensed User Longtime User Dec 29, 2014 #12 from web: You can't change a default font size. You can define a theme, and define a font size in your theme. You can read about defining themes and styles in the android developer reference documentation. ---- You can change font size, style etc in your application, but not for whole device. To do that i guess you need to root your phone and provide custom fonts with specified font size in it. Upvote 0
from web: You can't change a default font size. You can define a theme, and define a font size in your theme. You can read about defining themes and styles in the android developer reference documentation. ---- You can change font size, style etc in your application, but not for whole device. To do that i guess you need to root your phone and provide custom fonts with specified font size in it.
SalentoFC Member Licensed User Longtime User Dec 29, 2014 #13 Però potrei mettere un avviso iniziale dove avviso l'utente di controllare il settaggio della grandezza del carattere o è esteticamente brutto a vedersi? ------------------------------------- Can I put an advise at start where I indicate to the user to control the font size of default device or is a bad thing to do? Upvote 0
Però potrei mettere un avviso iniziale dove avviso l'utente di controllare il settaggio della grandezza del carattere o è esteticamente brutto a vedersi? ------------------------------------- Can I put an advise at start where I indicate to the user to control the font size of default device or is a bad thing to do?
LucaMs Expert Licensed User Longtime User Dec 29, 2014 #14 E non è quello che ti ho scritto io in #9? that is what I wrote in #9 Upvote 0
SalentoFC Member Licensed User Longtime User Dec 29, 2014 #15 Non l'avevo letto perdonami Anche se mi sembra strano non poter settare questa cosa da codice Sorry, I didn't read it. Seems strange is.not possible to set it from code Upvote 0
Non l'avevo letto perdonami Anche se mi sembra strano non poter settare questa cosa da codice Sorry, I didn't read it. Seems strange is.not possible to set it from code
Erel B4X founder Staff member Licensed User Longtime User Dec 30, 2014 #16 See this post: https://www.b4x.com/android/forum/threads/get-size-of-system-font-in-use.28065/#post-181853 Upvote 0
See this post: https://www.b4x.com/android/forum/threads/get-size-of-system-font-in-use.28065/#post-181853
LucaMs Expert Licensed User Longtime User Dec 30, 2014 #17 Erel said: See this post: https://www.b4x.com/android/forum/threads/get-size-of-system-font-in-use.28065/#post-181853 Click to expand... I have a sneaking suspicion that Accessibility uses the function that I have painstakingly "created" . I promise that in 2015 I will answer... after a month from the date of questions. (sneaking and painstakingly are not in my vocabulary but they come from Google Translate, of course) Upvote 0
Erel said: See this post: https://www.b4x.com/android/forum/threads/get-size-of-system-font-in-use.28065/#post-181853 Click to expand... I have a sneaking suspicion that Accessibility uses the function that I have painstakingly "created" . I promise that in 2015 I will answer... after a month from the date of questions. (sneaking and painstakingly are not in my vocabulary but they come from Google Translate, of course)
SalentoFC Member Licensed User Longtime User Dec 30, 2014 #18 I don't understand how to set userfontscale to "normal" I think to value 1 Upvote 0
LucaMs Expert Licensed User Longtime User Dec 30, 2014 #19 Check if on "Note 2" the characters were not the right size because of that setting (Accessibility - Large Text). If so, use the Erel's ResetUserFontScale Upvote 0
Check if on "Note 2" the characters were not the right size because of that setting (Accessibility - Large Text). If so, use the Erel's ResetUserFontScale