本文介紹了EditText 自動(dòng)換行的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!
問題描述
限時(shí)送ChatGPT賬號(hào)..
我想讓 EditText
的最大行數(shù)為 2,最大長度為 20.如果 EditText
長度超過 10,它應(yīng)該會(huì)自動(dòng)轉(zhuǎn)到一個(gè)新的行,因此用戶無需按 Enter.有人可以幫我解決這個(gè)要求嗎?
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"
這將在輸入數(shù)據(jù)時(shí)自動(dòng)將您的文本移動(dòng)到下一行.
This will automatically moves your text to next line while entering data.
這篇關(guān)于EditText 自動(dòng)換行的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!