本文介紹了EditText 自動換行的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
限時送ChatGPT賬號..
我想讓 EditText
的最大行數為 2,最大長度為 20.如果 EditText
長度超過 10,它應該會自動轉到一個新的行,因此用戶無需按 Enter.有人可以幫我解決這個要求嗎?
I want to make the EditText
with max lines of 2 and max length of 20. If the EditText
length is more than 10, it should automatically go to a new line so the user don't need to press Enter. Can someone help me with this requirement?
推薦答案
將此添加到您的 EditText xml 代碼中
android:inputType="textMultiLine"
android:inputType="textMultiLine"
這將在輸入數據時自動將您的文本移動到下一行.
This will automatically moves your text to next line while entering data.
這篇關于EditText 自動換行的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!