Android Question How can i put the image into the edittext?

Keith Yong

Active Member
Licensed User
Longtime User
Is the anyway for me to create the textbox with the image file base on the picture given?
 

Attachments

  • Screen Shot 2018-05-18 at 5.40.51 PM.png
    Screen Shot 2018-05-18 at 5.40.51 PM.png
    19 KB · Views: 192

Jeffrey Cameron

Well-Known Member
Licensed User
Longtime User
In prior versions of Android I used resource drawables to set it:
B4X:
Public Sub SetEditTextIcon(TextBox As EditText)
    Dim Bmpd As BitmapDrawable
    Dim poPhone As Phone
    Dim ST As String
    
    
    Bmpd = poPhone.GetResourceDrawable(17301583) 'ic_menu_search
    'Add to edittext1
    ST="android.graphics.drawable.Drawable"
    Dim R As Reflector
    R.Target = TextBox
    R.RunMethod4("setCompoundDrawablesWithIntrinsicBounds",Array As Object(Bmpd,Null,Null,Null),Array As String(ST,ST,ST,ST))
End Sub
 
Upvote 0
Top