SubName: EditTextSearch
Description: Add a graphic (search icon in this case) to an EditText
To set the size of a graphic you can set the bounds before adding to the View:
For more info and variations see the documentation:http://developer.android.com/refere...wablesWithIntrinsicBounds(int, int, int, int)
Depends on JavaObject, AndroidResources
Tags: EditText Graphic Icon
Description: Add a graphic (search icon in this case) to an EditText
B4X:
Sub EditTextSearch(EditTxt As EditText)
Dim AR As AndroidResources
Dim ETxt As JavaObject = EditTxt
ETxt.RunMethod("setCompoundDrawablesWithIntrinsicBounds",Array As Object(AR.GetAndroidDrawable("ic_menu_search"),Null,Null,Null))
End Sub
To set the size of a graphic you can set the bounds before adding to the View:
B4X:
Sub setButtonImage(Btn As Button,Img As BitmapDrawable)
Dim R As Rect
R.Initialize(0,0,40Dip,40Dip)
Dim ImgJO As JavaObject = Img
ImgJO.RunMethod("setBounds",Array As Object(R))
Dim Btn As JavaObject = btnFileItem
Btn.RunMethod("setCompoundDrawables",Array As Object(Img,Null,Null,Null))
End Sub
For more info and variations see the documentation:http://developer.android.com/refere...wablesWithIntrinsicBounds(int, int, int, int)
Depends on JavaObject, AndroidResources
Tags: EditText Graphic Icon
Last edited: