android TextView多行文本始终显示滚动条并自动定位到底部
来源:互联网 发布:中电海康研究院 知乎 编辑:程序博客网 时间:2024/05/17 01:59
效果:
java: 用handler循环调用这个方法即可
public static void scroll2Bottom(final ScrollView scroll, final View inner) {Handler handler = new Handler();handler.post(new Runnable() {@Overridepublic void run() {// TODO Auto-generated method stubif (scroll == null || inner == null) {return;}// 内层高度超过外层int offset = inner.getMeasuredHeight()- scroll.getMeasuredHeight();if (offset < 0) {System.out.println("定位...");offset = 0;}scroll.scrollTo(0, offset);}});}
XML: 关键设置scrollview的:android:fadeScrollbars="false"表示始终显示垂直滚动条
<ScrollView android:id="@+id/sv_show" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_above="@id/tl_botton" android:layout_alignParentTop="true" android:background="#E6E6FA" android:fadeScrollbars="false" android:scrollbarAlwaysDrawVerticalTrack="true" android:scrollbars="vertical" > <LinearLayout android:id="@+id/ll_layout" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#00FF00" > <TextView android:id="@+id/tv_show" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#FFC0CB" android:padding="@dimen/padding_medium" android:scrollbars="vertical" android:text="@string/hello_world" tools:context=".MainActivity" /> </LinearLayout> </ScrollView>
- android TextView多行文本始终显示滚动条并自动定位到底部
- android TextView多行文本始终显示滚动条并自动定位到底部
- Android TextView多行文本滚动实现
- Android TextView多行文本滚动实现与ScrollView的滚动条为隐藏的方法
- 多行文本框不显示滚动拉条
- vue 中 滚动条始终定位在底部
- android textview 多行文本显示 scroll滑动实现
- android可自动定位到底部的textview
- 多行文本框隐藏滚动条。
- JAVA滚动条自动下滑到底部
- 滚动条到底部自动加载
- 滚动条到底部,自动加载数据
- android中TextView多行文本滚动的实现及单行走马灯实现
- SWT带垂直滚动条的Text自动滚动到底部(比如显示聊天信息)
- CEdit显示并滚动到底部
- android EditText 自动滚动条并显示最新内容 .
- 怎样改变多行文本框滚动条的颜色??
- 怎样改变多行文本框滚动条的颜色??
- 也谈 TileCache 的安装、配置和使用
- Android UI 使用更快更高效
- oracle 学习心得
- Struts2 注意事宜
- 共享企业文化造就企业明天
- android TextView多行文本始终显示滚动条并自动定位到底部
- WebView 与 JS 之间的关系
- SharePoint 2013使用Exchange2013 配置传入电子邮件
- 最小生成树之Kruskal算法的实现
- oracle 数据类型
- Android--ListView 更高效的使用 Adapter
- Android TextView的各种属性
- apr_dbd_escape
- JavaSE基础复习:面向对象知识点二