android TextView添加滚动条
来源:互联网 发布:linux hadoop 单机 编辑:程序博客网 时间:2024/04/29 08:27
android TextView添加滚动条有两种方法
方法一:
Android默认TextView如果在一屏幕显示不下的话,是不会有滚动条的,解决方法是在<TextView>外面添加<ScrollView>标签;
1.<ScrollView
2. android:layout_width="fill_parent"
3. android:layout_height="wrap_content" >
4.
5. <TextView
6. android:layout_width="fill_parent"
7. android:layout_height="wrap_content"
8. android:textSize="50dp"
9. android:text="1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\12a\n13\n14\n" />
10.</ScrollView>
方法二:
经验证, 以下方法可用:
一、Xml代码
<TextView
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());
注意如果想要滚动条时刻显示, 必须加上以下语句:
textView.setScrollbarFadingEnabled(false);
- Android TextView 添加滚动条
- android TextView添加滚动条
- Android TextView文字过多,添加滚动条
- Android TextView文字过多,添加滚动条
- Android入门:向TextView添加滚动条
- 【android layout】为TextView添加滚动条
- Android TextView文字过多,添加滚动条
- Android TextView文字过多,添加滚动条
- TextView 添加滚动条
- Textview添加滚动条
- android textview 滚动条
- 给TextView添加滚动条
- Android中TextView内容过长 添加滚动条进行展示
- Android TextView 限制行数并添加滚动条
- Android TextView实现滚动条
- Android TextView滚动条设置
- Android入门:向TextView添加滚动条(添加<ScrollView>标签)
- Android设置带滚动条的TextView
- pig故障解决
- 开源框架ImageLoader的使用
- codechef Correctness of Knight Move题解
- Solaris系统安装Oracle12C截图欣赏
- HTML5 地理位置定位(HTML5 Geolocation)原理及应用
- android TextView添加滚动条
- LOD四叉树一些笔记
- DWZ选择行时获取对应的ID值
- 二叉树的建立以及六种递归非递归遍历
- 我第一次写博客
- 第一个struts2
- Android中从SD卡中/拍照选择图片并进行剪裁的方法
- C#Tostring的格式化
- C++ 11 并发: 正确 的使用条件变量-condition_variable