Gravity Problem on different Android devices

Ohanian

Active Member
Licensed User
Longtime User
Hi,

i have a sample app and here's the code :

B4X:
Sub Activity_Create(FirstTime As Boolean)
   Dim lblLeft, lblRight As Label
   Dim lstLeft, lstRight As ListView
   Dim Reflect As Reflector
   Dim intHeight As Int

   lblLeft.Initialize("")
   lblRight.Initialize("")
   
   lblLeft.Gravity = Gravity.LEFT
   lblLeft.Text = "Gravity.LEFT" & CRLF & "آ ب پ ت س"
   lblLeft.Color = Colors.Cyan
   lblLeft.TextColor = Colors.Black

   lblRight.Gravity = Gravity.RIGHT
   lblRight.Text = "Gravity.RIGHT" & CRLF & "آ ب پ ت س"
   lblRight.Color = Colors.Green
   lblRight.TextColor = Colors.Black
   
   Activity.AddView(lblLeft,0dip,0dip,100%x,-2)
   DoEvents
   Reflect.Target = lblLeft
   intHeight = Reflect.RunMethod("getHeight")

   Activity.AddView(lblRight,0dip,lblLeft.Top + intHeight,100%x,-2)
   DoEvents
   Reflect.Target = lblRight
   intHeight = Reflect.RunMethod("getHeight")

   lstLeft.Initialize("")
   lstLeft.SingleLineLayout.Label.Gravity = Gravity.LEFT
   lstLeft.AddSingleLine("1- Gravity.LEFT آ ب پ ت س")
   lstLeft.AddSingleLine("2- Gravity.LEFT آ ب پ ت س")
   lstLeft.AddSingleLine("3- Gravity.LEFT آ ب پ ت س")
   lstLeft.Color = Colors.LightGray
   Activity.AddView(lstLeft,0dip,lblRight.Top + intHeight,100%x,-2)
   DoEvents
   Reflect.Target = lstLeft
   intHeight = Reflect.RunMethod("getHeight")
   
   lstRight.Initialize("")
   lstRight.SingleLineLayout.Label.Gravity = Gravity.RIGHT
   lstRight.AddSingleLine("1- Gravity.RIGHT آ ب پ ت س")
   lstRight.AddSingleLine("2- Gravity.RIGHT آ ب پ ت س")
   lstRight.AddSingleLine("3- Gravity.RIGHT آ ب پ ت س")
   lstRight.Color = Colors.Gray
   Activity.AddView(lstRight,0dip,intHeight + lstLeft.Top,100%x,-2)
   
End Sub

As you can see there're two labels and two LV, with Left & Right gravity, its works fine on android 2.3 devices but on honeycomb devices it acts a little weird!
I've attached 2 screenshots; can anybody explain what's the problem is? Is there any solution for this?

tanx
 

Attachments

  • Android_2_3_3-Capture.jpg
    Android_2_3_3-Capture.jpg
    39 KB · Views: 220
  • Android_3_2_1-Capture.jpg
    Android_3_2_1-Capture.jpg
    54.4 KB · Views: 217

Inman

Well-Known Member
Licensed User
Longtime User
Arabic support was officially added to Android from Honeycomb only. May be that has something to do with this.
 
Upvote 0
Top