如何启用一个EditText的垂直滚动条编程 [英] how to enable vertical scrollbar of an edittext programmatically

查看:1557
本文介绍了如何启用一个EditText的垂直滚动条编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想实施的android:滚动条=被Java code在XML中的垂直
我试过的方法 setVerticalScrollBarEnabled(真),但它不工作。
任何人都可以给我一个建议?
先谢谢了。

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.

推荐答案

您可以使用结果
    的EditText ED =新的EditText(背景);
     ed.setScroller(新滚轮(上下文));
     ed.setVerticalScrollBarEnabled(真);

这将给予该编辑文本滚动选项,但它不会显示滚动条。

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

这篇关于如何启用一个EditText的垂直滚动条编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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