我正在创建一个包含编辑文本的动态布局.我想让这个编辑文本可滚动.
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模板网!
在android中剪切、复制、粘贴Cut, copy, paste in android(在android中剪切、复制、粘贴)
android EditText 融入背景android EditText blends into background(android EditText 融入背景)
更改 EditText 的线条颜色 - AndroidChange Line Color of EditText - Android(更改 EditText 的线条颜色 - Android)
EditText 始终显示带 2 位小数的数字EditText showing numbers with 2 decimals at all times(EditText 始终显示带 2 位小数的数字)
更改光标在展开的 EditText 中的开始位置Changing where cursor starts in an expanded EditText(更改光标在展开的 EditText 中的开始位置)
android中的EditText,adjustPan,ScrollView问题EditText, adjustPan, ScrollView issue in android(android中的EditText,adjustPan,ScrollView问题)