1

I have been trying to make an scrollable EditText work properly and thanks to this post it almost works but I am facing this problem now:

Scrolling works fine in the EditText while there are less than 6 lines, when you start adding more lines scrolling gets crazy and the scroll of the ScrollView starts moving.

Here is the EditText code:

<!-- Details Field -->

        <EditText
            android:id="@+id/details_value"
            android:layout_width="fill_parent"
            android:layout_height="100dp"
            android:gravity="top|left"
            android:hint="@string/hint_details"
            android:maxLength="250"
            android:scrollbars="vertical" />

And this is the code I use to enable scrolling inside the EditText:

    detailsEditText = (EditText) findViewById(R.id.details_value);

    detailsEditText.setOnTouchListener(new View.OnTouchListener()
    {
        @Override
        public boolean onTouch(final View v, final MotionEvent motionEvent) {
            if (v.getId() == R.id.details_value) {
                v.getParent().requestDisallowInterceptTouchEvent(true);
                switch (motionEvent.getAction() & MotionEvent.ACTION_MASK) {
                case MotionEvent.ACTION_UP:
                    v.getParent().requestDisallowInterceptTouchEvent(
                            false);
                    break;
                }
            }
            return false;
        }
    });

Any help?

Community
  • 1
  • 1
azorrozua
  • 89
  • 1
  • 5
  • 10
  • Why you have 2 EditText id (*details_value* and *details_edittext*)? – Rami Feb 04 '15 at 12:03
  • I did a mistake when copied the code. It is now edited and correct. @Rami – azorrozua Feb 04 '15 at 15:56
  • I have the same issue!!! I have added `editText` after a `LinearLayout` which contains `TextView`s. My `EditText`'s `layout_height` is `match_parent`, when I write one line in editText there is no problem but as the text goes in second line the entire view goes up and becomes visible and only after I close `keyboard` – Apurva Feb 04 '15 at 16:36
  • Have you got the solution? – Apurva Feb 05 '15 at 07:34
  • Not yet, I've tried limiting the maximum number of lines to 6 within the EditText with `android:maxlines=6` but it doesn't work and still permits to add more than 6 lines. – azorrozua Feb 06 '15 at 09:41

0 Answers0