Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maxlines not working when inputType is textMultiLine

This is my Edittext's xml code

        <EditText
        android:id="@+id/meeting_who_was_txt"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingLeft="15dp"
        android:gravity="top"
        android:scrollbars="vertical"
        android:layout_marginTop="5dp"
        android:paddingRight="15dp"
        android:inputType="textMultiLine"
        android:maxLines="2"/>

This is java code

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

when i run my app,multiLine working perfect in Edittext,but maxlines not working. What is a wrong in my code and how i can solve my problem?

like image 846
BekaKK Avatar asked Aug 12 '26 11:08

BekaKK


1 Answers

You just need to make sure you have the attribute "inputType" set. It doesn't work without this line.

android:inputType="text"

like image 121
Islam Ahmed Avatar answered Aug 15 '26 08:08

Islam Ahmed



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!