一、情景說明
1、情景
最近項(xiàng)目剛好有一個(gè)需求,需要在一個(gè)界面中用ScrollView嵌套一個(gè)滾動(dòng)的TextView和一個(gè)listView,既要不影響TextView內(nèi)容的滾動(dòng),也要使整個(gè)ScrollView可以滾動(dòng)起來,最終效果如下圖所示:
2、滾動(dòng)的TextView的實(shí)現(xiàn)
xml布局文件:
java代碼:<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" />
textView.setMovementMethod(ScrollingMovementMethod.getInstance());//設(shè)置可以滑動(dòng)