How to make multiline edittext in android
===

I try to create an edittext dynamically with LayoutParams.MATCHPARENT for its both width and height.
I have tried the following code, but it is still not working.

    EditText editor = ....;
    LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, 1);
    editor.setLayoutParams(params);
    editor.setGravity(Gravity.LEFT | Gravity.TOP);
    editor.setBackgroundColor(Color.WHITE);
    editor.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
    editor.setTextColor(Color.BLACK);
    //editor.setSingleLine(false);
    editor.setFocusableInTouchMode(true);
    editor.setInputType(EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE | EditorInfo.TYPE_TEXT_FLAG_IME_MULTI_LINE);
    editor.setMaxLines(Integer.MAX_VALUE);
    editor.setHorizontallyScrolling(false);
    editor.setTransformationMethod(null);

The code above let me to enter several lines, and an 'ENTER' button is displayed in the keyboard, but as I type on the edittext, the edit text scrolls horizontally if the width is not enough to display the text.
Can anybody please help me how to make the edittext multiline? 
