Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessory view (similar to inputAccessoryView for iOS) for Android keyboard

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.

like image 533
F L Avatar asked Jun 15 '12 00:06

F L


1 Answers

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.

like image 161
CommonsWare Avatar answered Jan 13 '23 06:01

CommonsWare