我是靠谱客的博主 贪玩香氛,最近开发中收集的这篇文章主要介绍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滚动所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

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

评论列表共有 0 条评论

立即
投稿
返回
顶部