moster67 Expert Licensed User Longtime User Mar 18, 2011 #1 I believe I read somewhere that labels are multiline by default. Is it possible to set a label as SingleLine just like you can do with EditText?
I believe I read somewhere that labels are multiline by default. Is it possible to set a label as SingleLine just like you can do with EditText?
moster67 Expert Licensed User Longtime User Mar 19, 2011 #2 Couldn't find that property so it is probably not possible. As a workaround I guess it is sufficient to ensure that the Height of the label is not higher than one single-line (perhaps also taking into account text-size). Upvote 0
Couldn't find that property so it is probably not possible. As a workaround I guess it is sufficient to ensure that the Height of the label is not higher than one single-line (perhaps also taking into account text-size).
zolive33 Active Member Licensed User Longtime User Aug 12, 2012 #3 You can use this method: Dim Mylabel as Label ... Dim ref As Reflector ref.Target = Mylabel ref.RunMethod2("setSingleLine", True, "java.lang.boolean") Click to expand... Upvote 0
You can use this method: Dim Mylabel as Label ... Dim ref As Reflector ref.Target = Mylabel ref.RunMethod2("setSingleLine", True, "java.lang.boolean") Click to expand...
Dave O Well-Known Member Licensed User Longtime User Nov 16, 2016 #4 FYI, the equivalent JavaObject sub is: Code: Copy Sub setLabelSingleLine(viewArg As View, singleLineArg As Boolean) Dim jo As JavaObject = viewArg jo.RunMethod("setSingleLine", Array As Object(singleLineArg)) End Sub I would love to see more and more of these secondary functions become native B4A methods, so we can use fewer reflector/JavaObject workarounds. Upvote 0
FYI, the equivalent JavaObject sub is: Code: Copy Sub setLabelSingleLine(viewArg As View, singleLineArg As Boolean) Dim jo As JavaObject = viewArg jo.RunMethod("setSingleLine", Array As Object(singleLineArg)) End Sub I would love to see more and more of these secondary functions become native B4A methods, so we can use fewer reflector/JavaObject workarounds.
klaus Expert Licensed User Longtime User Nov 16, 2016 #5 You find this and other Label properties in Label Utils in the Android Code Snippets forum. Upvote 0