Disable Enter in editText android

前端 未结 10 1662
别那么骄傲
别那么骄傲 2021-02-05 03:15

I have an EditText but I want only one line. I put lime this

1


        
相关标签:
10条回答
  • 2021-02-05 03:51

    android:maxLines="1" allows the text to be multiline but limits the height of edittext to display a single line.

    If you want to disable the enter (new line) key, set the input type to text

        android:inputType="text"
    
    0 讨论(0)
  • 2021-02-05 03:55

    Or if you wanna use java you could do this:

        edittext1.setSingleLine();
    
    0 讨论(0)
  • 2021-02-05 03:57

    You can set the input type to textEmailSubject. I head the same issue and it solve it!

    0 讨论(0)
  • 2021-02-05 03:59

    You may use

    <EditText 
       ......
       android:imeOptions="actionNext" OR "actionDone" />
    
    0 讨论(0)
提交回复
热议问题