一、情景说明


1、情景
      最近项目刚好有一个需求,需要在一个界面中用ScrollView嵌套一个滚动的TextView和一个listView,既要不影响TextView内容的滚动,也要使整个ScrollView可以滚动起来,最终效果如下图所示:
photoshop培训,电脑培训,电脑维修培训,移动软件开发培训,网站设计培训,网站建设培训 photoshop培训,电脑培训,电脑维修培训,移动软件开发培训,网站设计培训,网站建设培训 photoshop培训,电脑培训,电脑维修培训,移动软件开发培训,网站设计培训,网站建设培训



2、滚动的TextView的实现
xml布局文件:

<TextView
        android:id="@+id/textView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:maxHeight="100dp"
        android:scrollbars="vertical"
        android:text="啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦"
        android:textSize="20dp" />

java代码:

textView.setMovementMethod(ScrollingMovementMethod.getInstance());//设置可以滑动

网友评论