how to enable vertical scrollbar of an edittext programmatically

孤者浪人 提交于 2019-12-06 08:54:07

问题


I'm trying to implement android:scrollbars="vertical" in XML by Java code. I've tried method setVerticalScrollBarEnabled(true) but it doesn't work. Anyone can give me a suggestion? Thanks in advance.


回答1:


you can use
EditText ed=new EditText(context); ed.setScroller(new Scroller(context)); ed.setVerticalScrollBarEnabled(true);

this will give the scroll option for the edit text but it won't show the scroll bar.



来源:https://stackoverflow.com/questions/8417454/how-to-enable-vertical-scrollbar-of-an-edittext-programmatically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!