Textview Scrollable In Scrollview
I have a ScrollView at the top node of an activity, with several TextView inside. I want some of these (1 out of 2) TextView scrollable themselves. They are doing more than 5 lines
Solution 1:
Try this way,
<?xml version="1.0" encoding="utf-8"?><ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true"><LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"><TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textStyle="italic"
android:text ="Blabla"/><TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/blanc"
android:maxLines="5"
android:scrollbars="vertical"
android:text="Blablabla1\nBlablabla2\nBlablabla3\nBlablabla4\nBlablabla5\nBlablabla6\nBlablabla7\nBlablabla8\n"/><TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textStyle="italic"
android:text ="Blabla"/><TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/blanc"
android:maxLines="5"
android:scrollbars="vertical"
android:text="Blablabla1\nBlablabla2\nBlablabla3\nBlablabla4\nBlablabla5\nBlablabla6\nBlablabla7\nBlablabla8\n"/><TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textStyle="italic"
android:text ="Blabla"/><TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/blanc"
android:maxLines="5"
android:scrollbars="vertical"
android:text="Blablabla1\nBlablabla2\nBlablabla3\nBlablabla4\nBlablabla5\nBlablabla6\nBlablabla7\nBlablabla8\n"/></LinearLayout></ScrollView>
Solution 2:
ScrollView or no doesn't matter. The solution is to do that more in you Java Code:
textviewtv.setMovementMethod(newScrollingMovementMethod());
Thanks : Android:Textview with vertical scrolling text
Post a Comment for "Textview Scrollable In Scrollview"