0

The LinearLayout scrolls but the EditText doesn't.

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="top"
        android:orientation="vertical" >


        <EditText
            android:id="@+id/messageeditor_editText2"
            android:layout_width="match_parent"
            android:layout_height="200dp"/>

    </LinearLayout>
</ScrollView>

I am setting EditText scrollable with:

editText.setMovementMethod(new ScrollingMovementMethod());

EDIT:

I tried to do the following but don't know how to disable my scrollview, this is a focus change listener for my edittext:

private OnFocusChangeListener focuschangelistener = new OnFocusChangeListener(){

    @Override
    public void onFocusChange(View arg0, boolean arg1) {
        if(arg1){
            sv.setEnabled(false);
        }else{
        }           
    }

};
Miky
  • 942
  • 2
  • 14
  • 29

2 Answers2

2

did you find solution? someone said that below code can solve problem

final EditText myEditText = (EditText) findViewById(R.id.EditText01);
myEditText.setMovementMethod(new ScrollingMovementMethod());
Winston
  • 1,800
  • 2
  • 20
  • 30
1

you have given fix height that is 200dp please change it to match_parent or increase it. Then check.

It will work as you want.

Feel free to comments.

Shreyash Mahajan
  • 23,386
  • 35
  • 116
  • 188