so I was developing an app with Android Studio and I added a 'textview' box in the screen. However, when I tested the app on my device, the text was too small to read. So I tried searching on the web about how to change the text size, but I could only find videos and posts about how to change the font of the android studio product itself. Please tell me how to change the text size in the textview box. I would appreciate any help.
You can add the following property in the text view's xml and start increasing the number till you reach the font-size you want
android:textSize="20sp"
The sp here inherits the font size the user sets in his/her android device so the same font size may vary on two identical devices
Related
I'm a novice programmer and I'm working on one of the my first projects on Android Studio for a school work.
I have to create an application that consists on a TextView where the user can write some text and on a button that permits to open a sort of menu where the user can choose the text's size. When the user select an option from this list, the written text should change its size.
The problem is that I don't have idea in which way I can change the size in the TextView when I select an option. Is there a specific function that permit to change the size of the written text?
You could use those
This one is for change font in SP size:
TextViewXXX.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16);
This one is for make text BOLD
TextViewXXX.setTypeface(null, Typeface.BOLD);
Yes, you can use TextView.setTextSize(float). But, TextViews must have scale-independent pixels to support multiple screens and font size configurations (sp). So, you can use TextView.setTextSize(int unit, float size) where the value for unit would be COMPLEX_UNIT_SP and size is the required size of the text.
I'm developing an app for android using Rad Studio 10.1 and I'm having trouble with a new font that I'm trying to implement into my project. The problem is, I have to use accentuation in my app because is for portuguese language users, and portuguese has a lot of accentuation. I found a good font on the internet and I want to use, but when I put into a label, the label cuts the top part of the text. An image to explain better:
As you can see, just the accentuation of the top are being cutted, should be a 'Ã'. The bottom accentuation 'Ç' are just normal, and this just happen with UpperCase texts. Someone have any idea why this is happening?
EDIT: Aditional information: The TLabel is alredy set on Client Alignment
When I change the android text size to xlarge through the system, my app will go out of range. I tried to find some solutions to solve this problem which is AutoResizeTextView, but I do not find good solution for editText and something else.
What is the correct way to solve the text size changing issue, I do not want to set the text size, I want to depend on the user setting to change it and auto fit screen.
Thank you
I have found a strange behavior of the application text size when I change the system font size settings on a Appcelerator Studio application.
In iOS and Android < 5.x it works fine. Always I can see fonts without scale. On Android 5.x text inside a WebView and other components like a AlertDialog or TextField, I notice a scaled font size. I want the app respect text size, prevent the OS settings change. I don't know why on Android 5.x don't have the same behavior. Is there a buy? or there are any configuration parameter to avoid this?
I try to get de size of an alert text trying to check the change buy It's no possible. If it not posible to avoid this at least should be something to check if system font size has changed and show an alert to the user.
I already try to set ti.ui.defaultunit on "dp" or other values with the same results.
The Label component don't change the font size in any case.
Thanks in advance.
Is it possible to change the default-fontsize only for one app?
So i can use the "sp" units at all my fonts?
The problem is that my customer doesn´t wan´t that his employes changes anything in the android-settings. So i am searching for a solution to change the font size in my app. Of course i could implement my own dynamic font size by programmatically changing the size of each label when the user chooses another size. But i think that is to complicated and should by the last way.
Best regards
Yannick