textview跑马灯和水平滚动条
2015-07-28 17:28
218 查看
跑马灯如下:
<TextView
android:layout_width="100px"
android:layout_height="wrap_content"
android:text="234254fadfadffadfadfgfhdgfhjhfjhfjhjfhjfhjfhjfhjtyteytryet"
android:marqueeRepeatLimit="marquee_forever"
android:ellipsize="marquee"
android:scrollHorizontally="true"
android:focusableInTouchMode="true"
android:focusable="true"></TextView>
水平滚动条:
一、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
android:layout_width="100px"
android:layout_height="wrap_content"
android:text="234254fadfadffadfadfgfhdgfhjhfjhfjhjfhjfhjfhjfhjtyteytryet"
android:marqueeRepeatLimit="marquee_forever"
android:ellipsize="marquee"
android:scrollHorizontally="true"
android:focusableInTouchMode="true"
android:focusable="true"></TextView>
要显示该跑马灯,view必须要获得焦点,只有在取得焦点的情况下跑马灯才会显示
水平滚动条:
一、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());
相关文章推荐
- POJ2762 Going from u to v or from v to u?(强联通分量)
- AppStore 发布游戏分辨率列表。 From:https://itunesconnect.apple.com
- nyoj 苹果
- 康拓展开,逆康拓模板
- java-实现资源访问的超时和并发控制
- [iOS]调用layoutSubViews方法(有的时候为啥会调用2遍)
- oracle 11 impdb expdb使用方法
- Node.js笔记(十)Nodejs与DOM操作
- Linux 端口-> PID -> 启动目录
- Stones(优先队列)
- threadid=1: thread exiting with uncaught exception (group=0x40db8930)
- NFS服务器的安装与配置
- Jquery中获取iframe的代码(window.top.parent)
- static 和 const的区别与联系
- C++ STL栈和队列的使用
- 让Apache Shiro保护你的应用
- C++ STL栈和队列的使用
- web.xml解析
- 字符串练习题
- iOS 应用程序的生命周期详解