android 让TextView自带滚动条
16lz
2021-12-04
android 让 TextView 自带滚动条
一、Xml代码
- android:id="@+id/textview"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:singleLine="false"
- android:maxLines="5"
- android:scrollbars="vertical"
- />
二、还需要在代码中设置 TextView 相应的方法
- TextView textView = (TextView)findViewById(R.id.text_view);
- textView.setMovementMethod(ScrollingMovementMethod.getInstance());
好了,大功告成。
更多相关文章
- Android学习札记22:ThumbnailUtils
- Dialog设置全屏
- Android(安卓)Studio 快捷键
- android延续按两次返回退出程序(完整代码)
- Android之仿iphone抖动效果
- android studio 调试android源码
- Android(安卓)TextView 字体加粗
- Android(安卓)SDK的docs访问速度很慢
- Android(安卓)4.0 的 GridLayout