5

I think I've tried every combination, but I can't get the alpha keyboard to show the return key. It's always a "Done" button, which is not useful. On a Nexus 7 (4.1), it's worse, and shows a stupid smiley button along with the Done button, which makes no sense for my application. It's fine to have a Done button as long as I have a return button. Here's one of many options I've tried:

<AutoCompleteTextView
    android:id="@+id/annotate_edit"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginBottom="15dp"
    android:layout_marginLeft="60dp"
    android:layout_marginRight="60dp"
    android:layout_marginTop="15dp"
    android:completionThreshold="1"
    android:inputType="textCapSentences|textImeMultiLine"
    android:imeOptions="actionDone"
    android:lines="1"
    android:maxLength="18"
    android:textSize="30px" />

I've tried with and without the imeOpitons line, and various inputType options including removing it. There are options to make it a search button (not helpful), but nothing listed to make it a return key. I've also tried with "lines=2", which did not fix it. Any other ideas?

Frank
  • 605
  • 1
  • 8
  • 14
  • I think this may be keyboard/device specific. For example, on my GNex, an AutoCompleteTextView created in code with no options set defaults to having a return key, no smiley or 'done'. Just as an aside, why do you want a return key on an AutoCompleteTextView anyway? I normally don't associate them with multi-line input. – Geobits Oct 18 '12 at 02:24
  • It's for a sign display that may have 1 or 2 returns. For example: Happy\nBirthday. I have a large set of pre-defined phrases as well that are feed into the autoComplete. It's possible the problem is a design limitation of AutoComplete that doesn't support line feeds, but still seems like a odd limitation if true. – Frank Oct 18 '12 at 15:52

1 Answers1

4

Right now you have set imeOptions="actionDone". You say you've tried removing it, but all that does it default it to actionDone again, per the docs.

Try setting imeOptions="actionNone" instead. That should give you no action and force a return key.

I don't know that that by itself will guarantee a working multiline AutoCompleteTextView, however. I have one in an app, and it shows a return key on all my devices. The difference is the behaviour of the return key.

For instance, on my GNex (4.1), when you press return it line feeds properly.

On my SGS2 (2.3), nothing happens when you press it. No multiline, no completion. Just a dead button.

It could be the difference in the default EditText style in different APIs, so you should also try setting inputType="textMultiLine". There may be a subtle difference between that and textImeMultiLine.

Geobits
  • 22,218
  • 6
  • 59
  • 103
  • 1
    The trick was to avoid using: `android:inputType`, as it appears to force it into single line mode. It even overrides options like `android:singleLine="false"`. Thanks for helping to point me in the right direction! – Frank Oct 18 '12 at 18:52
  • 1
    Actually, you can use set android:inputType and default imeOption to remain Enter. You just concatenate: "|textMultiLine" to your android:inputType like this: android:inputType="textCapSentences | textMultiLine" – miroslavign Apr 04 '16 at 10:12