Mr.Sandy
Mr.Sandy

Reputation: 4349

I need custom Done button on keyboard in Android

enter image description here

Anyone help to add DONE button on top of soft keyboard like above screenshot shows.

Because I need Enter and Done both button on my Edit Text. So, please suggest me If anyone have Idea. Thanks in Advance...

Upvotes: 0

Views: 1971

Answers (3)

artkoenig
artkoenig

Reputation: 7257

You would like to have an easy solution? Then integrate your "Done" button in your layout. Your layout should look like this (short version):

<LinearLayout orientation="vertical">
  <ScrollView layout_weight="1"> <-- if needed, use FrameLayout else
    place your Layout here
  </ScrollView>
  <YourDoneButton/>
</LinearLayout>

Your Button will stack on the top of the keyboard. I assume, that the user should be able to click of the "Done" button even if the keyboard is hidden. If not, you can hide it if your EditText is not focused.

Upvotes: 0

Bartosz Kraszewski
Bartosz Kraszewski

Reputation: 233

How about just adding a custom Button in the bottom of your UI?

  • You can observe layout size changes -> find a case when keyboard appears and disappears (Remember its different case from screen rotation, different screen proportion)

  • Based on keyboard hidden/shown event you can show/hide your custom UI.

I guess only problem is, you don't know what is keyboard view background. But its definitely better than writting your own keyboard, AFAIK you can't add views to keyboards.

Upvotes: 2

Related Questions