第一种在layout中
第一步:添加android:scrollbars="vertical" 属性,指可以横向滑动还是竖向滑动
<TextView
android:id="@+id/tv_content"
android:scrollbars="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="19dp"
android:includeFontPadding="false"
android:textColor="#333333"
android:textSize="15sp" />
第二步:给这个控件设置,这个属性必须加
tv_content = mView.findViewById(R.id.tv_content);
//支持点击
tv_content.setMovementMethod(ScrollingMovementMethod.getInstance());
第二种在java类中
//等价于android:scrollbars="vertical"
textView.setVerticalScrollBarEnabled(true);
//支持点击
tv_content.setMovementMethod(ScrollingMovementMethod.getInstance());
最后
以上就是贪玩香氛最近收集整理的关于textview滚动的全部内容,更多相关textview滚动内容请搜索靠谱客的其他文章。
发表评论 取消回复