How to make EditText hint not to wrap?

2020-07-04 05:47发布

I have a one line EditText, when I set a long hint, the hint wraps to two lines. Can I force the EditText to be always one line tall? android:lines="1" didn't work.

3条回答
再贱就再见
2楼-- · 2020-07-04 06:28

Have you tried android:ellipsize yet? This can be set to truncate the line to end in "..." either at the start, the middle, the end, or you can set it to marquee (scroll across). Not sure offhand whether this applies to hints or not, but it should.

查看更多
够拽才男人
3楼-- · 2020-07-04 06:31

Try android:singleLine="true"

查看更多
够拽才男人
4楼-- · 2020-07-04 06:39

Use android:maxLines="1" or android:singleLine="true" instead of android:lines="1"

查看更多
登录 后发表回答