eclipse Android EditText 不是多行

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14576942/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 19:53:26  来源:igfitidea点击:

Android EditText not Multi Line

androideclipseandroid-edittextmultiline

提问by Ms. B

Possible Duplicate:
restrict edittext to single line

可能的重复:
将编辑文本限制为单行

I have 2 edit texts. My problem is, when I press the enter button in the keyboard, it creates another set of line. Or it creates like a next line in my edit text. I want to remove it and I want it to be in single line. Even if I enter the enter key in the keyboard, still it won't create a next line.

我有 2 个编辑文本。我的问题是,当我按下键盘上的 Enter 按钮时,它会创建另一组行。或者它在我的编辑文本中创建像下一行。我想删除它,我希望它在单行中。即使我在键盘上输入回车键,它仍然不会创建下一行。

How do you do it?

你怎么做呢?

回答by IssacZH.

Try this in your EditText xml

在你的 EditText xml 中试试这个

android:singleLine="true"

回答by edwin

 <EditText
    android:id="@+id/edittextView1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:maxLines="1"
    android:singleLine="true"/>

Try this with your edit text in layout

在布局中使用您的编辑文本试试这个