user1461511
user1461511

Reputation: 77

Android: how to make multiline text auto scroll down?

I want to make the multiline text auto scroll down as I add in more text:

<EditText
        android:id="@+id/Text"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_above="@+id/TypeBox"
        android:layout_below="@+id/ReceiverName"
        android:layout_marginLeft="10dip"
        android:layout_marginRight="10dip"
        android:layout_weight="0.65"
        android:ems="10"
        android:focusable="false"
        android:gravity="bottom"
        android:inputType="textMultiLine|textNoSuggestions" >
</EditText>

I have tried searching for it but all i could find is auto scroll of a text box within a scroll view.

Upvotes: 1

Views: 1667

Answers (3)

Jaspreet Kaur
Jaspreet Kaur

Reputation: 1720

Add bellow code in activity onCreate(), this Add scroll behavior to text view

    textView.setMovementMbehavior ScrollingMovementMethod());

 <TextView
            android:id="@+id/textView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:layout_marginBottom="5dp"
            android:layout_marginTop="5dp"
            android:text="text"
            android:textColor="#ffffff"
            android:textSize="20sp"/>

Upvotes: 0

MarGin
MarGin

Reputation: 2518

android:inputType="textMultiLine"
android:editable="true"
android:enabled="true"
android:minLines="6"
android:maxLines="6"
android:isScrollContainer="true"
android:focusable="true"

Refer this link for more info

https://alvinalexander.com/source-code/android/android-edittext-isscrollcontainer-example-how-make-multiline-scrolling

Upvotes: 1

Ratna Halder
Ratna Halder

Reputation: 2004

I think, you need to add a line:

android:inputType="textFilter|textMultiLine|textNoSuggestions"

Upvotes: 0

Related Questions