O omoba Active Member Licensed User Longtime User Jan 28, 2013 #1 Hi, I created a seekbar to increase and decrease font size. When I increase the font size and the text gets big enough/too big, the text goes outside the view-able range of the label. Is there a way to prevent this from happening? Thanks
Hi, I created a seekbar to increase and decrease font size. When I increase the font size and the text gets big enough/too big, the text goes outside the view-able range of the label. Is there a way to prevent this from happening? Thanks
derez Expert Licensed User Longtime User Jan 28, 2013 #2 You should limit the size set by the seekbar, say to FontLimit: B4X: sub sb_ValueChanged (Value As Int, UserChanged As Boolean) fontsize = min(Value, FontLimit) Another way is to use canvas methods, B4X: MeasureStringWidth (Text As String, Typeface As android.graphics.Typeface, TextSize As Float) As Float or to measure the Height with MeasureStringHeight Last edited: Jan 28, 2013 Upvote 0
You should limit the size set by the seekbar, say to FontLimit: B4X: sub sb_ValueChanged (Value As Int, UserChanged As Boolean) fontsize = min(Value, FontLimit) Another way is to use canvas methods, B4X: MeasureStringWidth (Text As String, Typeface As android.graphics.Typeface, TextSize As Float) As Float or to measure the Height with MeasureStringHeight