Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7667713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:10:32+00:00 2026-05-31T15:10:32+00:00

I have a nasty problem. I have EditText (8 lines) inside ScrollView . And

  • 0

I have a nasty problem. I have EditText(8 lines) inside ScrollView. And when I’m trying to scroll text in EditText it’s behavior is not stable. Sometimes it’s scrolling, some times it’s not taking focus.

This is my layout file, to make my question more clear:

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:padding="8dp" >

    <TextView
        android:id="@+id/wo_task_name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/no_description" />

    <TextView
        android:id="@+id/wo_task_description"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/no_description" />

    <TextView
        android:id="@+id/wo_task_comments_label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:text="@string/comments" />

    <Button
        android:id="@+id/wo_task_select_comment"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/select_comment_from_template" />

    <EditText
        android:id="@+id/wo_task_comments"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="top|left"
        android:hint="@string/enter_your_comment_here"
        android:lines="8"
        android:maxLines="10"
        android:minLines="6"
        android:scrollbars="vertical"
        android:singleLine="false" />
</LinearLayout>

I understand that I’m having this issue because of holding one scrollable control inside another, yet I don’t know what to do with this. So, please help me if you can.

Thanks in advance.

public void initComments(final View view) {
    EditText comment = (EditText) view.findViewById(R.id.wo_task_comments);

    comment.setOnTouchListener(new OnTouchListener() {

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

    comment.setText(currentTask.getComment() + "very very long comment"
            + "very very long comment\n" + "very very long comment\n"
            + "very very long comment\n" + "very very long comment\n"
            + "very very long comment");
}

I’ve tried this, and no result. I’m still unable to scroll my editbox.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T15:10:34+00:00Added an answer on May 31, 2026 at 3:10 pm

    Try:

    @Override
    public void onCreate(Bundle savedInstanceState) {
        .....  
        EditText et = (EditText)findViewById(R.id.wo_task_comments);
        et.setOnTouchListener(this);
        .....
    }
    
    @Override
    public boolean onTouch(View view, MotionEvent motionEvent) {
        if(view.getId() == R.id.wo_task_comments){
            view.getParent().requestDisallowInterceptTouchEvent(true);
            switch (motionEvent.getAction() & MotionEvent.ACTION_MASK) {
                case MotionEvent.ACTION_UP:
                    view.getParent().requestDisallowInterceptTouchEvent(false);
                    break;
            }
        }
        return false;
    }
    

    In your case:

    public class MyActivity extends Activity  {
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        initComments(findViewById(R.id.YOUR_MAIN_LAYOUT_ID));  
    }
    
    
    public void initComments(final View view) {
        EditText comment = (EditText) view.findViewById(R.id.wo_task_comments);
    
        comment.setOnTouchListener(new View.OnTouchListener() {
    
            @Override
            public boolean onTouch(final View v, final MotionEvent motionEvent) {
                if (v.getId() == R.id.wo_task_comments) {
                    v.getParent().requestDisallowInterceptTouchEvent(true);
                    switch (motionEvent.getAction() & MotionEvent.ACTION_MASK) {
                        case MotionEvent.ACTION_UP:
                            v.getParent().requestDisallowInterceptTouchEvent(
                                    false);
                            break;
                    }
                }
                return false;
            }
        });
    
        comment.setText("very very long comment"
                + "very very long comment\n" + "very very long comment\n"
                + "very very long comment\n" + "very very long comment\n"
                + "very very long comment\n" + "very very long comment\n"
                + "very very long comment\n" + "very very long comment\n"
                + "very very long comment\n" + "very very long comment\n"
                + "very very long comment\n" + "very very long comment\n"
                + "very very long comment\n" + "very very long comment\n"
                + "very very long comment\n" + "very very long comment\n"
                + "very very long comment");
    }
    

    }

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have encountered a rather nasty problem with the DataGridView control (Windows.Forms, .NET Framework
I have a nasty problem. I want to get rid of a certain database
We have a nasty little problem. In short we can detect if a screen
I have been struggling with a nasty ANR problem with my app, which loads
I have a little, but nasty problem: I have a database with many records,
I have a nasty problem referencing resources when using a Maven project and Jar
I have a really nasty problem with bindings. I know that there are other
I'm debugging a nasty problem where #include ing a file(not anything I wrote, for
My team and I have this nasty problem with parsing a string received from
We have recently started using git and had a nasty problem when someone committed

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.