android TextView scrollable method without ScrollViewe
- 2020-05-19 05:44:19
- OfStack
code
TextView textview = (TextView) findViewById(R.id.text);
/** *
* Only if this method is called, TextView Talent doesn't depend on ScrollView And I'm going to scroll.
* Want to be in XML Set in the TextView the textcolor Otherwise, when TextView When it is touched, it falls away.
*/
textview.setMovementMethod(ScrollingMovementMethod.getInstance());
xml file
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="18sp"
android:scrollbars="vertical"
android:maxLines="12"
android:textColor="@color/white"
android:text="@string/str"
android:id="@+id/text"
></TextView>