zoukankan      html  css  js  c++  java
  • TextView不用ScrollViewe也可以滚动的方法

    转自:http://www.jb51.net/article/43377.htm

    android TextView不用ScrollViewe也可以滚动的方法。

    TextView textview = (TextView) findViewById(R.id.text);
                /**             * 
                 * 只有调用了该方法,TextView才能不依赖于ScrollView而实现滚动的效果。
                 * 要在XML中设置TextView的textcolor,否则,当TextView被触摸时,会灰掉。
                 */

                textview.setMovementMethod(ScrollingMovementMethod.getInstance());

    xml:

     1 <TextView
     2    xmlns:android="http://schemas.android.com/apk/res/android"
     3   android:layout_width="fill_parent"
     4   android:layout_height="wrap_content"
     5   android:textSize="18sp"
     6   android:scrollbars="vertical"
     7    android:maxLines="12"
     8   android:textColor="@color/white"
     9   android:text="@string/str"
    10   android:id="@+id/text"
    11   ></TextView>
  • 相关阅读:
    header
    panel----单个基础版
    vue-demo
    js不同类型变量比较
    reset.css
    关于各个浏览器的兼容问题
    git
    AMD与CMD区别
    喜欢前端的看过来哦
    js中数组去重的几种方法
  • 原文地址:https://www.cnblogs.com/Sunnor/p/6507522.html
Copyright © 2011-2022 走看看