安卓开发小效果--走马灯
16lz
2021-12-04
使在layout 中 实现文字滚动效果 也就是走马灯的效果 只需要在响应控件里面加上这几行代码就可以
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:focusable="true"
android:focusableInTouchMode="true"
android:singleLine="true"
设置单行显示。如果和layout_width一起使用,当文本不能全部显示时,后面用“…”来表示,不设置singleLine或者设置为false,文本将自动换行
其中android:ellipsize有这么几个属性
android:ellipsize=”start”—–省略号显示在开头 "...pedia"
android:ellipsize=”end”——省略号显示在结尾 "encyc..."
android:ellipsize=”middle”—-省略号显示在中间 "en...dia"
android:ellipsize=”marquee”–以横向滚动方式显示(需获得当前焦点时)
android:marqueeRepeatLimit="marquee_forever"
设置循环次数
android:focusable="true"
focusable=true
允许该button获取焦点
但button在触摸屏下无法获取焦点
android:focusableInTouchMode="true"
对于控件来说,第一下点击时不会触发onClick事件,只是焦点转移到了TextView上,然后第二下点击才会触发onClick
转载于:https://www.cnblogs.com/xqxacm/p/4240069.html
更多相关文章
- Android利用TextView制作跑马灯该效果
- Android(安卓)layout布局属性、标签属性总结大全。
- 【转】android中Textview如何限制在一行显示且多余字符自动截断
- ImageView下载图片加载
- 使用SlidingDrawer的隐藏/显示搜索框
- 2.6.1 使用toast显示提示信息框
- 使用SlidingDrawer的隐藏/显示搜索框
- 使用SlidingDrawer的隐藏/显示搜索框
- android将EditText设置为只可点击 不弹出软键盘不显示光标