Marcos Alves Well-Known Member Licensed User Longtime User Jul 8, 2018 #1 Is it possible to determine the best width for a label considering that it must to fit in only one line and adjusted to the text inside?
Is it possible to determine the best width for a label considering that it must to fit in only one line and adjusted to the text inside?
asales Expert Licensed User Longtime User Jul 8, 2018 #2 "You can set the width to -2.This is a special constant that sets the width to match the text." (Erel: https://www.b4x.com/android/forum/threads/adjusting-label-width-according-to-text.30871/#post-179483) Upvote 0
"You can set the width to -2.This is a special constant that sets the width to match the text." (Erel: https://www.b4x.com/android/forum/threads/adjusting-label-width-according-to-text.30871/#post-179483)
Marcos Alves Well-Known Member Licensed User Longtime User Jul 9, 2018 #3 asales said: "You can set the width to -2.This is a special constant that sets the width to match the text." (Erel: https://www.b4x.com/android/forum/threads/adjusting-label-width-according-to-text.30871/#post-179483) Click to expand... Thanks, I'll test Upvote 0
asales said: "You can set the width to -2.This is a special constant that sets the width to match the text." (Erel: https://www.b4x.com/android/forum/threads/adjusting-label-width-according-to-text.30871/#post-179483) Click to expand... Thanks, I'll test
Erel B4X founder Staff member Licensed User Longtime User Jul 9, 2018 #4 I don't recommend using -2. If you want to automatically adjust the text size: https://www.b4x.com/android/forum/threads/custom-view-autotextsizelabel.30642/#content The other option is to use Canvas.MeasureStringWidth to find the width. Upvote 0
I don't recommend using -2. If you want to automatically adjust the text size: https://www.b4x.com/android/forum/threads/custom-view-autotextsizelabel.30642/#content The other option is to use Canvas.MeasureStringWidth to find the width.
Marcos Alves Well-Known Member Licensed User Longtime User Jul 9, 2018 #5 Erel said: I don't recommend using -2. If you want to automatically adjust the text size: https://www.b4x.com/android/forum/threads/custom-view-autotextsizelabel.30642/#content The other option is to use Canvas.MeasureStringWidth to find the width. Click to expand... Thanks @Erel ... I'll try using Canvas... looks better than changing the labels by a customview.. Upvote 0
Erel said: I don't recommend using -2. If you want to automatically adjust the text size: https://www.b4x.com/android/forum/threads/custom-view-autotextsizelabel.30642/#content The other option is to use Canvas.MeasureStringWidth to find the width. Click to expand... Thanks @Erel ... I'll try using Canvas... looks better than changing the labels by a customview..