Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make edittext in Android scrollable?

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.

like image 364
andro-girl Avatar asked Apr 29 '11 11:04

andro-girl


2 Answers

I know this question has already got an answer, but if you wish to get the same result via XML, change

android:inputType="text"

to

android:inputType="textMultiLine"

for a vertically scrollable EditText.

like image 188
Advait Saravade Avatar answered Oct 30 '22 01:10

Advait Saravade


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

like image 36
andro-girl Avatar answered Oct 30 '22 01:10

andro-girl