Android EditText Multiline does not work as it should

前端 未结 3 1767
野趣味
野趣味 2021-01-11 22:23

I\'m pretty desperate about this feature. I tried pretty much everything there is to find to made these EditTexts multiline enabled, but they just keep going on a single lin

3条回答
  •  南方客
    南方客 (楼主)
    2021-01-11 22:34

    hey you have to add the following code in xml file ..

    android:gravity="top"
    android:maxLines="4"
    android:inputType="textMultiLine"
    android:scrollbars="vertical"
    android:textSize="16sp"
    android:padding="10dp"
    

    and you have to put activity file ...

    edtComment = (EditText) findViewById(R.id.edtComment);
    edtComment.setMovementMethod(new ScrollingMovementMethod());
    

    this is works for me and hope it will works for you .....

提交回复
热议问题