Android EditText vertical scroll issue

I have an EditText of a predetermined size, if the user enters more text, I cannot scroll the text, but it can scroll using the track ball, how can I solve this problem.

+3
source share
4 answers

If you want the text to scroll horizontally, define the EditText in the XML tag:

android:scrollHorizontally="true"

If you want vertical scrolling, define in the XML tag EditText:

android:scrollbars = "vertical"

Hope this helped.

+22
source

make the following changes to get the scroller in your EditText

questionEntry.setScroller(new Scroller(myContext)); 
questionEntry.setMaxLines(1); 
questionEntry.setVerticalScrollBarEnabled(true); 
questionEntry.setMovementMethod(new ScrollingMovementMethod()); 

How to make edittext in Android scrollable?

Remember to vote if you feel that my answer is useful to you.

Thanks Deepak

+13
source

In java

 EditText dwEdit = (EditText) findViewById(R.id.DwEdit);       
 dwEdit.setOnTouchListener(new OnTouchListener() {
       public boolean onTouch(View view, MotionEvent event) {
            // TODO Auto-generated method stub
            if (view.getId() ==R.id.DwEdit) {
                view.getParent().requestDisallowInterceptTouchEvent(true);
                switch (event.getAction()&MotionEvent.ACTION_MASK){
                case MotionEvent.ACTION_UP:
                    view.getParent().requestDisallowInterceptTouchEvent(false);
                    break;
                }
            }
            return false;
        }
    });

In xml

<EditText
android:id="@+id/DwEdit"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:minLines="10"
android:scrollbarStyle="insideInset"
android:scrollbars="vertical" 
android:overScrollMode="always"
android:inputType="textCapSentences">
</EditText> 
+8
source

@Sunil Kumar Sahoo's answer worked for me, but I had to delete the line

questionEntry.setMaxLines(1); 
-1
source

All Articles