android - TextView scrollable in ScrollView -
i have scrollview @ top node of activity, several textview inside. want of these (1 out of 2) textview scrollable themselves. doing more 5 lines each want visitor see 5 lines , have scroll watch complete text. do... doesn't work:
<?xml version="1.0" encoding="utf-8"?> <scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <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>
doing that, textviews put 5 first lines, not scrollable.
what do wrong?
try 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>
Comments
Post a Comment