C Christian García S. Active Member Licensed User Sep 20, 2019 #1 Hello, maybe you can help me. I have two edittext with this characteristics: And I put background to these with: Code: Dim cd As ColorDrawable cd.Initialize2(Colors.White,8dip,1,0xFF808080) txtCodigo.Background = cd txtAdicional.Background = cd All works fine: When I clicked on a text, the right edge was lost I have tried to change the layout of the images, their alignment, but the same behavior is always repeated, I have changed the size of the text and I always have the same results. Thanks Christian.
Hello, maybe you can help me. I have two edittext with this characteristics: And I put background to these with: Code: Dim cd As ColorDrawable cd.Initialize2(Colors.White,8dip,1,0xFF808080) txtCodigo.Background = cd txtAdicional.Background = cd All works fine: When I clicked on a text, the right edge was lost I have tried to change the layout of the images, their alignment, but the same behavior is always repeated, I have changed the size of the text and I always have the same results. Thanks Christian.
Sagenut Expert Licensed User Longtime User Sep 21, 2019 #2 Do not use the same ColorDrawable for different items. That generate that behaviour. Upvote 0
Sagenut Expert Licensed User Longtime User Sep 21, 2019 #4 Good that it helped. I suggest You to create a sub like this Code: Sub background (backcolor As Int, radius As Int, borderwidth As Int, bordercolor As Int) As ColorDrawable Dim cd As ColorDrawable cd.Initialize2(backcolor,radius,borderwidth,bordercolor) Return cd End Sub Then every time You need to set a ColorDrawable to a view just type Code: MyView.Background = background(Colors.White,8dip,1,0xFF808080) Of course You can pass different parameters as needed at every call. In this way You don't need to create a single variable for every view. Upvote 0
Good that it helped. I suggest You to create a sub like this Code: Sub background (backcolor As Int, radius As Int, borderwidth As Int, bordercolor As Int) As ColorDrawable Dim cd As ColorDrawable cd.Initialize2(backcolor,radius,borderwidth,bordercolor) Return cd End Sub Then every time You need to set a ColorDrawable to a view just type Code: MyView.Background = background(Colors.White,8dip,1,0xFF808080) Of course You can pass different parameters as needed at every call. In this way You don't need to create a single variable for every view.