我正在创建一个包含编辑文本的动态布局.我想让这个编辑文本可滚动.
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可滚动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!