源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

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

  • 时间:2020-12-29 19:51 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:android TextView不用ScrollViewe也可以滚动的方法
代码
[u]复制代码[/u] 代码如下:
TextView textview = (TextView) findViewById(R.id.text);             /**             *              * 只有调用了该方法,TextView才能不依赖于ScrollView而实现滚动的效果。              * 要在XML中设置TextView的textcolor,否则,当TextView被触摸时,会灰掉。              */             textview.setMovementMethod(ScrollingMovementMethod.getInstance());  
xml文件
[u]复制代码[/u] 代码如下:
<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>  
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部