T tpakis Active Member Licensed User Longtime User Dec 10, 2014 #1 I think i found a bug in Label. When i display long text in android 2.3 it doesn't auto wrap the content. It works fine in android 4+ and it used to run fine when the app was compiled with b4a 2.5. Is there anyway to bypass this problem?
I think i found a bug in Label. When i display long text in android 2.3 it doesn't auto wrap the content. It works fine in android 4+ and it used to run fine when the app was compiled with b4a 2.5. Is there anyway to bypass this problem?
T tpakis Active Member Licensed User Longtime User Dec 10, 2014 #2 Found the solution: Code: Copy Dim r As Reflector r.Target = Labeltxt r.RunMethod2("setSingleLine", False, "java.lang.boolean") Still don't know why it happens only in android 2.2-2.3
Found the solution: Code: Copy Dim r As Reflector r.Target = Labeltxt r.RunMethod2("setSingleLine", False, "java.lang.boolean") Still don't know why it happens only in android 2.2-2.3
Jeffrey Cameron Well-Known Member Licensed User Longtime User Feb 24, 2015 #3 I've had to start doing this when I want multi-line labels since I upgraded to B4A 4.30. Is this intended or have I overlooked a new "multi-line" property in the designer?
I've had to start doing this when I want multi-line labels since I upgraded to B4A 4.30. Is this intended or have I overlooked a new "multi-line" property in the designer?
Erel B4X founder Staff member Licensed User Longtime User Feb 25, 2015 #4 I don't think that the behavior has changed in v4.30. The label implementation hasn't changed in this version.
I don't think that the behavior has changed in v4.30. The label implementation hasn't changed in this version.
Jeffrey Cameron Well-Known Member Licensed User Longtime User Feb 25, 2015 #5 I'm not sure what to say, I used see no difference before upgrading. Running an AVD with Gingerbread (2.2) it works fine: Running the same application on a real phone with Gingerbread (2.3.6), it does not work without the code posted above: It's a very simple test program. A layout with one label and one button, in the activity create: Code: Copy Activity.LoadLayout("layTest") Label1.Gravity = Gravity.TOP + Gravity.RIGHT Label1.text = "Line One" & CRLF & "Line two" & CRLF & "Line 3" Other than writing a routine to iterate through all controls looking for labels and using the "setSingleLine" function on each do you have any suggestions?
I'm not sure what to say, I used see no difference before upgrading. Running an AVD with Gingerbread (2.2) it works fine: Running the same application on a real phone with Gingerbread (2.3.6), it does not work without the code posted above: It's a very simple test program. A layout with one label and one button, in the activity create: Code: Copy Activity.LoadLayout("layTest") Label1.Gravity = Gravity.TOP + Gravity.RIGHT Label1.text = "Line One" & CRLF & "Line two" & CRLF & "Line 3" Other than writing a routine to iterate through all controls looking for labels and using the "setSingleLine" function on each do you have any suggestions?
Erel B4X founder Staff member Licensed User Longtime User Feb 26, 2015 #6 I did try to reproduce it on several devices here and didn't see this behavior. You can however call this sub to set all labels: Code: Copy Sub SetMultiLine For Each v As View In Activity.GetAllViewsRecursive If v Is Label Then Dim lbl As Label = v If lbl.Text.Contains(CRLF) Then Dim jo As JavaObject = lbl jo.RunMethod("setSingleLine", Array(False)) End If End If Next End Sub
I did try to reproduce it on several devices here and didn't see this behavior. You can however call this sub to set all labels: Code: Copy Sub SetMultiLine For Each v As View In Activity.GetAllViewsRecursive If v Is Label Then Dim lbl As Label = v If lbl.Text.Contains(CRLF) Then Dim jo As JavaObject = lbl jo.RunMethod("setSingleLine", Array(False)) End If End If Next End Sub
Jeffrey Cameron Well-Known Member Licensed User Longtime User Feb 26, 2015 #7 Thanks, I'll use that going forward.
ArminKH Well-Known Member Mar 1, 2015 #8 @Erel @tpakis this is not a bug comment theme in manifest and then it will works perfectly the holo theme not worked on android 2.3 and label's text is 1 line ever if you use holo theme on android 2.3 comment theme or change it to another like Theme.Light you should change theme or compile your project with api 10 for works good on android 2.3 i think by using custom theme not any issue appare longer best regards Last edited: Mar 1, 2015
@Erel @tpakis this is not a bug comment theme in manifest and then it will works perfectly the holo theme not worked on android 2.3 and label's text is 1 line ever if you use holo theme on android 2.3 comment theme or change it to another like Theme.Light you should change theme or compile your project with api 10 for works good on android 2.3 i think by using custom theme not any issue appare longer best regards
Jeffrey Cameron Well-Known Member Licensed User Longtime User Mar 2, 2015 #9 Excellent information, Arminkh, thank you!