8

Can someone please direct me on how I can add something similar to inputAccessoryView for Android?

I'd like to add an extra row of custom buttons like shown in the bar above the keyboard here:

enter image description here

Thank you!

P.S. I am using standard default keyboard.

F L
  • 478
  • 1
  • 7
  • 18

1 Answers1

9

This is not possible, unless you create your own input method editor. You cannot modify somebody else's input method editor from your app.

In the screenshot, what you think is "an extra row of custom buttons" is not part of the input method editor. It is part of the activity. If I had to guess, the layout file for that activity would look roughly like this (pseudo-code only -- this will not directly compile):

<LinearLayout android:orientation="vertical">
  <ScrollView android:layout_height="0dp" android:layout_weight="1">
    <LinearLayout android:orientation="vertical">
      <!-- the form goes in here -->
    </LinearLayout>
  </ScrollView>
  <LinearLayout android:orientation="horizontal" android:layout_height="wrap_content">
    <!-- the button bar goes here -->
  </LinearLayout>
</LinearLayout>

That, along with android:windowSoftInputMode="adjustResize" on the <activity> element in your manifest, should give you the UI you seek -- the button bar will be immediately above the input method editor.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • screen with this layout freezes when opened, API level 16 – Alex Sorokoletov Jul 27 '14 at 22:01
  • @AlexSorokoletov: The "layout" in this is pseudo-code and will not directly compile, as is noted in the answer itself. If you derived some layout from this, and you are having problems with that layout, you are welcome to open a Stack Overflow question of your own to seek help. – CommonsWare Jul 27 '14 at 22:03
  • I didn't use this layout directly, however I derived from it. Thank you for opening question suggestion, however I used another solution http://stackoverflow.com/a/11120597/883738 – Alex Sorokoletov Jul 28 '14 at 01:34
  • Simple, but clever! – Tash Pemhiwa Jul 18 '16 at 09:01