如何使键盘显示返回键? [英] How to get the keyboard to show a return key?

查看:66
本文介绍了如何使键盘显示返回键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我已经尝试了每种组合,但是我无法让Alpha键盘显示返回键.它始终是完成"按钮,没有用.在Nexus 7(4.1)上,情况更糟,它显示了一个愚蠢的笑脸按钮以及完成"按钮,这对我的应用程序来说毫无意义.只要有返回按钮,就可以使用完成"按钮.这是我尝试过的众多选择之一:

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" />

我尝试了是否使用imeOpitons行,以及包括删除它在内的各种inputType选项.有一些使其成为搜索按钮的选项(无用),但没有列出任何使其成为返回键的选项.我也尝试过"lines = 2",但没有解决.还有其他想法吗?

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?

推荐答案

现在,您已经设置了 imeOptions ="actionDone" .您说您尝试过删除它,但是所有这样做都会默认地将它重新设置为 actionDone ,每个

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.

尝试设置 imeOptions ="actionNone" .那应该不给您采取任何措施,并强制使用回车键.

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

但是我不知道它本身会保证多行的AutoCompleteTextView工作.我的一个应用程序中有一个,它在我所有的设备上都显示一个返回键.区别在于返回键的行为.

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.

例如,在我的GNex(4.1)上,按回车键时,换行正确.

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

在我的SGS2(2.3)上,按下该按钮时什么也没有发生.没有多行,没有完成.只是一个死按钮.

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

在不同的API中,默认的EditText样式可能有所不同,因此您还应该尝试设置 inputType ="textMultiLine" .与 textImeMultiLine 之间可能存在细微差别.

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.

这篇关于如何使键盘显示返回键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆