Android Question Customise virtual keyboard button

jcesar

Active Member
Licensed User
Longtime User
Hi

Is there a way to change the icon of the virtual keyboard button to a "search" icon and associate this button to trigger a custom procedure ?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
The following code will show a "Search" button and will handle it. I'm not sure whether it is possible to show the magnifying glass without creating a small XML layout with the EditText (see XmlLayoutBuilder library).

B4X:
Sub Globals
   Private EditText1 As EditText
End Sub

Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("1")
   Dim jo As JavaObject = EditText1
   jo.RunMethod("setImeActionLabel", Array As Object("Search", 0x00000003))
   Dim IME As IME
   IME.Initialize("IME")
   IME.AddHandleActionEvent(EditText1)
End Sub

Sub IME_HandleAction As Boolean
   Log("action")
   Return True
End Sub
 
Upvote 0

jcesar

Active Member
Licensed User
Longtime User
Thanks Erel, but dont work, the magnifying glass is not displayed in the button.

I think i need set up this textbox property android:imeOptions="actionSearch" but i dont know how do this.

Must be possible with XmlLayoutBuilder but i prefer create my layouts with designer.

Maybe this could be a new feature to a future b4a version.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…