Android Question Labels resizing bug?

Mark.S

Member
Licensed User
I have a series of array labels placed vertically on a panel, same height, various widths.
when a listview (on a panel) which is being used as a menu has concluded they resize

The menu does partially cover the labels.
Touching any of the labels causes them to return to their original width
same bug also occurs if i use a spinner

any ideas ?

I've tried;
moving the menu, so as not to cover any of the effected labels.
invalidate (Each label)
Dim J As JavaObject = ControlPanel
j.RunMethod("requestLayout", Null)
doevents (last result!)
 

Peter Simpson

Expert
Licensed User
Longtime User
Can you upload an example of what is happening to you. I've tried recreating your issue but it's working perfectly fine here...
 
Upvote 0

Mark.S

Member
Licensed User
Notice that the right hand edge outline of two of the labels disappear as well.
Any guidance will be much appreciated.
 

Attachments

  • ScreeenShots.jpg
    ScreeenShots.jpg
    116.7 KB · Views: 230
Upvote 0

Mark.S

Member
Licensed User
Removing SetTextSize does not solve the problem
App is designed to work with an 8" Samsung Tablet, so have not thought of using anchors etc


B4X:
'Control Panel Inputs
    Cd.Initialize2 (Colors.ARGB (255,255,255,255),0,2, Colors.Black)
    Dim Data(9) As Int
    Data = Array As  Int(150dip,275dip,120dip,250dip,35dip,177dip,70dip,60dip,140dip,45dip) ' Label Width Info
    Dim Text(10) As String
    Text = Array As String("Enterprise","Three Horseshoes - Flackwell Heath","AWP","Queen It's Kind Of Magic 100p","A1","K.Terms","28.98","N/a","PubCo","14") ' ****Default Temp Data *****
    For X = 0 To 9
        ControlInput(X).Initialize("ControlIn")
        ControlInput(X).Background = Cd
        ControlInput(X).TextColor = Colors.Black
        ControlInput(X).Gravity = Gravity.LEFT+ Gravity.CENTER_VERTICAL
        ControlInput(X).TextSize= 20
        ControlInput(X).Typeface = Typeface.DEFAULT
        ControlInput(X).Tag =X
        ControlInput(X).Text = Text(X)
        ControlInput(X).Padding = Array As Int (5dip, 0dip, 0dip, 0dip)
        ControlPanel.AddView(ControlInput(X),125dip,40dip+(LineSpace *X),Data(X),29dip)  ' Linespace = 28dip
    Next
'Ajust text size to fit Site Name Box
    For X = 1 To 3
         SetTextSize(ControlInput(X),ControlInput(X).Text)    'Site Name /Machine Name/
    Next
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
1.
B4X:
 Dim Data(9) As Int
    Data = Array As  Int(150dip,275dip,120dip,250dip,35dip,177dip,70dip,60dip,140dip,45dip)
You are creating an array with 9 elements and then assigning a new array.
Better:
B4X:
Dim Data() As Int = Array As Int(150dip, ...)

2. Prefer Lists over arrays.

3. You should never share a drawable object between different views.
 
Upvote 0

Mark.S

Member
Licensed User
Thanks Erel,
The problem appears to be with the drawable object.

Can you please explain why you should never share a Drawable Object.
How do i give each label the same attributes without using Cd? (border etc)
 
Upvote 0
Top