Android: Can't figure how to use setImeActionLabel

后端 未结 1 905
野性不改
野性不改 2020-11-30 04:56

What I want to do is change the default \"Done\" label that appears in the virtual keyboard. Here\'s what I\'ve tried without any luck:

mSearchInput.setImeOp         


        
相关标签:
1条回答
  • 2020-11-30 05:33

    The imeActionLabel sets the label for the button that appears on the top right on full screen IME mode (i.e., when your phone is in landscape). If you want to change the button to the bottom right of the keyboard, you can pass certain flags to imeOptions.

    As far as I know, for that button you're limited to a certain set of actions (see here for a full list of supported flags), but since you seem to want a search button, all you have to do is to slightly adjust your first line and use IME_ACTION_SEARCH:

    mSearchInput.setImeOptions(EditorInfo.IME_ACTION_SEARCH);
    

    Mind you, the exact appearance of that button will depend on the input method. The default Android keyboard shows a magnifier for the search flag, while the Touch Input (HTC's keyboard) seems completely unaware of that flag, still showing a return button.

    0 讨论(0)
提交回复
热议问题