本文介紹了如何使Android中的edittext可滾動?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
限時送ChatGPT賬號..
我正在創建一個包含編輯文本的動態布局.我想讓這個編輯文本可滾動.
I am creating a dynamic layout that contains an edit text. I want to make this edit text scrollable.
questionEntry.setMaxLines(1);
questionEntry.setVerticalScrollBarEnabled(true);
questionEntry.setMovementMethod(new ScrollingMovementMethod());
使用此代碼,我使我的編輯文本可滾動.但問題是當我輸入一些東西時.如果它到達編輯文本的末尾,它將停止輸入我的文本并且不會自動跳到下一行.如果我按回車鍵,它會跳轉.我想讓它自動化.
Using this code I made my edit text scrollable. But the problem is when I am typing something. If it reaches the end of the edit text, it will stop typing my text and not automatically jump to the next line. If I press the enter key, it will jump. I want to make it automatic.
推薦答案
questionEntry.setScroller(new Scroller(myContext));
questionEntry.setMaxLines(1);
questionEntry.setVerticalScrollBarEnabled(true);
questionEntry.setMovementMethod(new ScrollingMovementMethod());
我對之前的代碼做了一些更改.
上面貼的是我的新代碼.
i made some changes in my previous code.
above posted is my new code.
它正在工作......謝謝大家
it s working...thanks for all
這篇關于如何使Android中的edittext可滾動?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!