How to display multiple lines of text with scrolling in android?
It is possible to create multiline text view with scroll view. I used the following code in your application:
Txt_VistaRecetasola = (TextView) findViewById(R.id.txt_vistarectsola);
Txt_VistaRecetasola.setMovementMethod(ScrollingMovementMethod.getInstance());
Txt_VistaRecetasola.setScrollBarStyle(0x03000000);
Txt_VistaRecetasola.setVerticalScrollBarEnabled(true);
Txt_VistaRecetasola.setTextColor(0xFF000000);
Check below code
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textColor="#000000"
android:textSize="17dip"
android:inputType="textMultiLine"
android:scrollbars="vertical"
/>
You can limit the Height of TextView
to match the number of lines you user wants to see, then simply put your TextView
in a ScrollView
I had done a simple example to demonstrate this...
<ScrollView android:layout_height="30dp"
android:layout_width="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="30dp"
android:textSize="16sp"
android:id="@+id/tv1"
/>
</ScrollView>