Android Question Why are EditText and Labels displayed differently?

vecino

Well-Known Member
Licensed User
Hello, several EditText and a Label that have the same height, font, size, etc. are displayed well in a Label and are displayed badly (cropped) in the EditText.
Both have a background to put rounded corners with this code.
How can I fix this?
Thanks.

B4X:
Sub Redondear ( iClrFondo As Int ) As ColorDrawable
    Dim cd As ColorDrawable
    Dim clrFondo As Int
    '
    If iClrFondo=0 Then
        clrFondo = globales.iColorCelesteMedio
    Else
        clrFondo = iClrFondo
    End If
    Dim const clrBorde As Int = globales.iColorCelesteOscuro
    '
    cd.Initialize2(clrFondo,16dip,1dip,clrBorde)
    '
    Return cd
End Sub
ejemplo.jpg
 

vecino

Well-Known Member
Licensed User
If you look at the screenshot I posted before, they don't have padding.
I believe that the padding is added automatically when I change the background with the code that I put before:
B4X:
edUnidades2.Background = PaintBackground(False)

Sub PaintBackground( bFocused As Boolean ) As ColorDrawable
    Dim cd As ColorDrawable
    Dim const clrFondoConFoco As Int = globales.iColorCelesteClaro
    Dim const clrFondoSinFoco As Int = globales.iColorCelesteMedio
    Dim const clrBorde        As Int = globales.iColorCelesteOscuro
    Dim clrFondo As Int
    '
    If bFocused Then
        clrFondo = clrFondoConFoco
    Else
        clrFondo = clrFondoSinFoco
    End If
    '
    cd.Initialize2(clrFondo,16dip,1dip,clrBorde) 
    '
    Return cd
End Sub
 
Upvote 0

agraham

Expert
Licensed User
If you look at the screenshot I posted before, they don't have padding.
Wrong. They do have default. padding. It is nothing to with changing the background. As I said before try it with some code logging the values, before and after changing the background. Also as I said before the Designer does not display the default values.
 
Last edited:
Upvote 0
Top