L leatherguy Member Licensed User Longtime User Mar 20, 2011 #1 Hi all is there a way to find out what textsize to select to display a number of lines in a label? for instance I have a label that is 60 height and I want to display 3 lines in it. How to calculate the right textsize? Or label.height is 120 and I want to display a maximum of 5 lines. Also is there a way to calculate the needed space for a textline? I want to fit my text on all devices regardless of the activity size. Thanks in advance
Hi all is there a way to find out what textsize to select to display a number of lines in a label? for instance I have a label that is 60 height and I want to display 3 lines in it. How to calculate the right textsize? Or label.height is 120 and I want to display a maximum of 5 lines. Also is there a way to calculate the needed space for a textline? I want to fit my text on all devices regardless of the activity size. Thanks in advance
Erel B4X founder Staff member Licensed User Longtime User Mar 21, 2011 #2 You can use Canvas.MeasureStringWidth / MeasureStringHeight to measure the size of a given text (not including the gaps between lines). You will need to first initialize the Canvas. You can initialize it by passing a view or by first creating a mutable bitmap. Upvote 0
You can use Canvas.MeasureStringWidth / MeasureStringHeight to measure the size of a given text (not including the gaps between lines). You will need to first initialize the Canvas. You can initialize it by passing a view or by first creating a mutable bitmap.