Bug? Bug in Label and wrap

tpakis

Active Member
Licensed User
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?
 

tpakis

Active Member
Licensed User
Found the solution:
B4X:
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
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?
 

Jeffrey Cameron

Well-Known Member
Licensed User
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:
B4X:
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

Administrator
Staff member
Licensed User
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:
B4X:
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
 

ArminKH

Well-Known Member
@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:
Top