user1108995
user1108995

Reputation: 175

text scroll inside edittext of a linear layout which in scrollview in android

I have an UI issue like, some EditText s are there in LinearLayout ,and this linear layout is placed in scroll view . now what i want to do is edit text has large amount of data for seeing this data i have set android:scrollbars ="vertical" by this i'm able to see the scroll bar inside the edit text but the data is not scrolling. out side scrollbar is moving.how to fix this issue.

can anybody help me. Thanks in Advance.

Upvotes: 1

Views: 907

Answers (2)

Atul Bhardwaj
Atul Bhardwaj

Reputation: 6707

This may help you....

parentScrollView.setOnTouchListener(new View.OnTouchListener() {

                    public boolean onTouch(View v, MotionEvent event) {
                        Log.v(TAG,"PARENT TOUCH");
                        findViewById(R.id.child_scroll).getParent().requestDisallowInterceptTouchEvent(false);
                        return false;
                    }
                });
                childScrollView.setOnTouchListener(new View.OnTouchListener() {

                    public boolean onTouch(View v, MotionEvent event)
                    {
                        Log.v(TAG,"CHILD TOUCH");
                         //  Disallow the touch request for parent scroll on touch of child view
                        v.getParent().requestDisallowInterceptTouchEvent(true);
                        return false;
                    }
                });

In your case 'parentScrollView' is your scrollView while childScrollView is your Linearlayout/EditText

Upvotes: 6

Chirag
Chirag

Reputation: 56925

Use yourEditTextView.setMovementMethod(new ScrollingMovementMethod());

Upvotes: 1

Related Questions