如何使Android中的edittext可滚动? [英] How to make edittext in Android scrollable?

查看:55
本文介绍了如何使Android中的edittext可滚动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个包含编辑文本的动态布局.我想让这个编辑文本可滚动.

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可滚动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆