完成的键未显示在键盘上 [英] Done key not showing up on keyboard

查看:136
本文介绍了完成的键未显示在键盘上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个Android应用程序,并希望在用户在键盘上键入内容时将完成的键显示在键盘上. 这是EditText的XML代码:

I am making an Android app and want the done key to show up on the keyboard when the user is typing into the keyboard. This is the XML code for the EditText:

    <EditText
    android:id="@+id/answer"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:ems="10"
    android:gravity="center_horizontal"
    android:textColor="#ffffff"
    android:layout_marginBottom="113dp"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:imeOptions="actionDone"
    />

我认为添加android:imeOptions="actionsDone会显示完成按钮,但是这里有回车按钮,当按下回车按钮时,将在EditText中创建新行.有什么问题吗?

I thought that adding the android:imeOptions="actionsDone would have the done button appear, but instead the enter button is there and when it is pressed, a new line is created in the EditText. What is the issue?

推荐答案

通过添加imeOptions不会得到done. 将以下属性添加到您的EditText中:

You will not get done by adding imeOptions. Add the below attribute to your EditText:

android:singleLine="true"

这将使您的EditText成为一行,如果这是唯一的EditText或最后一个EditText,您将看到Done按钮.如果有多个EditText项目,那么您将看到Next按钮.

This will make your EditText a single line and you will see the Done button if that is the only EditText or last EditText. If there are multiple EditText items, then you will see Next button.

这篇关于完成的键未显示在键盘上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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