G GaNdAlF89 Active Member Licensed User Longtime User Mar 5, 2014 #1 How can I do to calculate the correct text size of label and edit text (based on its dimensions) in a layout dinamic/relative?
How can I do to calculate the correct text size of label and edit text (based on its dimensions) in a layout dinamic/relative?
Erel B4X founder Staff member Licensed User Longtime User Mar 5, 2014 #2 You can use AutoTextSizeLabel: [custom view] AutoTextSizeLabe This label will change its text size to make sure that it fits the width. Another option is to set the text size with the designer and then call AutoScaleAll. Check it with the UI cloud. Upvote 0
You can use AutoTextSizeLabel: [custom view] AutoTextSizeLabe This label will change its text size to make sure that it fits the width. Another option is to set the text size with the designer and then call AutoScaleAll. Check it with the UI cloud.
RandomCoder Well-Known Member Licensed User Longtime User Mar 5, 2014 #3 I think that you may need to use a canvas to work out the text length and then adjust the size until it fits your label. Take a look at the scrolling labels code module, I think it will help.... http://www.b4x.com/android/forum/threads/scrolling-labels.8831/#post-49199 Regards, RandomCoder. Upvote 0
I think that you may need to use a canvas to work out the text length and then adjust the size until it fits your label. Take a look at the scrolling labels code module, I think it will help.... http://www.b4x.com/android/forum/threads/scrolling-labels.8831/#post-49199 Regards, RandomCoder.
RandomCoder Well-Known Member Licensed User Longtime User Mar 5, 2014 #4 As always, Erel has a better solution. RandomCoder Upvote 0
G GaNdAlF89 Active Member Licensed User Longtime User Mar 12, 2014 #5 Erel said: Another option is to set the text size with the designer and then call AutoScaleAll. Check it with the UI cloud. Click to expand... How can I do this? Another question, I've set the label width and height with percentage, there is any formula to set the text size? Something like this: B4X: Label1.TextSize = Label1.Height * 0.3 Upvote 0
Erel said: Another option is to set the text size with the designer and then call AutoScaleAll. Check it with the UI cloud. Click to expand... How can I do this? Another question, I've set the label width and height with percentage, there is any formula to set the text size? Something like this: B4X: Label1.TextSize = Label1.Height * 0.3
Erel B4X founder Staff member Licensed User Longtime User Mar 13, 2014 #6 See this tutorial: Supporting multiple screens - tips and best practices There is no simple way to calculate the text size. See the source code in AutoTextSizeLabel class. Upvote 0
See this tutorial: Supporting multiple screens - tips and best practices There is no simple way to calculate the text size. See the source code in AutoTextSizeLabel class.