Creating a scroll bar for TextView in android
deepak - Sat Jan 21 2012 20:51:53 GMT-0500 (EST)
Creating a scroll bar for Text view in android
Creating a scroll bar for Text view in android
deepak - Sat Jan 21 2012 20:57:38 GMT-0500 (EST)
There are multiple ways to do this
1) We can use a scroll view
2) We can set some of the text view properties to achieve it
deepak - Sat Jan 21 2012 21:00:45 GMT-0500 (EST)
Using Method 2 (Changing text view properties)
<TextView
android:id="@+id/text_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="false"
android:maxLines="3"
android:scrollbars="vertical"
android:textColor="@android:color/secondary_text_dark_nodisable"
>
</TextView>
TextView textView = (TextView)findViewById(R.id.text_view);
textView.setMovementMethod(ScrollingMovementMethod.getInstance());
deepak - Sat Jan 21 2012 21:29:06 GMT-0500 (EST)
Using Method 1 (Using Scroll View)
<ScrollView android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@id/button1">
<TextView android:id="@+id/txt2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="txt2"/>
</ScrollView>