Hi!
I have the following problem:
I'm trying to set an image at the left of a button with text on it. I can't make it look correct to all screens, so I thought if it is right to use labels as buttons, because labels with reflection library can have an icon everywhere I want and keep their text!
Is my thought good?
Update:
I don't know if it is right, but I'm sharing this with you in case that is correct. Using the following code, I have gained the desired results:
I have the following problem:
I'm trying to set an image at the left of a button with text on it. I can't make it look correct to all screens, so I thought if it is right to use labels as buttons, because labels with reflection library can have an icon everywhere I want and keep their text!
Is my thought good?
Update:
I don't know if it is right, but I'm sharing this with you in case that is correct. Using the following code, I have gained the desired results:
B4X:
Sub SetIconToButton(iBtn As Button,iBmp As BitmapDrawable,iL As Int,iT As Int,iW As Int,iH As Int)
Dim ST As String
Dim Lx As LabelExtras
ST = "android.graphics.drawable.Drawable"
Dim Rf As Reflector
Rf.Target = iBtn
Lx.SetDrawableBounds(iBmp,iL,iT,iW,iH)
Rf.RunMethod4("setCompoundDrawablesRelative",Array As Object(iBmp,Null,Null,Null),Array As String(ST,ST,ST,ST))
End Sub
Last edited: