Leo
Leo

Reputation: 1433

how to enable vertical scrollbar of an edittext programmatically

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.

Upvotes: 4

Views: 5149

Answers (1)

Finder
Finder

Reputation: 1217

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.

Upvotes: 2

Related Questions