我是靠谱客的博主 贪玩香氛,这篇文章主要介绍textview滚动,现在分享给大家,希望可以做个参考。

第一种在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滚动内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(55)

评论列表共有 0 条评论

立即
投稿
返回
顶部