Android Question Bug or programming error?

strupp01

Active Member
Licensed User
I am working with the current B4A version 9.50. Have a minni program created and settled that shows the following strange reactions.
1. The text box is not completely bordered at startup (Figure 1)
2. If the text field is clicked on and possibly labeled, the middle field (a label) changes to the extent that the rear border is missing (Figure 2)
upload_2019-12-1_13-16-48.png

Figure 1
upload_2019-12-1_13-17-36.png

Figure 2

Am I doing something wrong ?
 

Attachments

  • Test_Label.zip
    9.1 KB · Views: 47

DonManfred

Expert
Licensed User
Am I doing something wrong ?
Yes. You are reusing the same ColorDrawable which you should not.

Solution:
B4X:
    Dim c As ColorDrawable
    c.Initialize2(Colors.LightGray,5dip,3dip,Colors.Red)
    EditText1.Background = c
    Dim c As ColorDrawable
    c.Initialize2(Colors.LightGray,5dip,3dip,Colors.Red)
    Label1.Background = c
    Dim c As ColorDrawable
    c.Initialize2(Colors.LightGray,5dip,3dip,Colors.Red)
    Label2.Background = c

or

B4X:
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("1")
    EditText1.Background = CreateCD(Colors.LightGray,5dip,3dip,Colors.Red)
    Label1.Background = CreateCD(Colors.LightGray,5dip,3dip,Colors.Red)
    Label2.Background = CreateCD(Colors.LightGray,5dip,3dip,Colors.Red)
End Sub
Sub CreateCD(color As Int,CornerRadius As Int, BorderWidth As Int, BorderColor As Int) As ColorDrawable
    Dim c As ColorDrawable
    c.Initialize2(color,CornerRadius,BorderWidth,BorderColor)
    Return c   
End Sub
 
Last edited:
Upvote 0
Top