文字跑马灯
复制代码
1
2
3
4<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">
复制代码
1
复制代码
1
2
3//padding指当前视图与内部内容的距离 //orientation指定线性布局的方向 //horizontal(默认)表示水平布局,vertical垂直
复制代码
1//margin指当前视图与周围视图的距离
复制代码
1//gravity指定布局内部视图与本线性布局的对齐方式
复制代码
<
TextView
android
:layout_width=
"match_parent"
android
:layout_height=
"wrap_content"
android
:layout_marginTop=
"20dp"
android
:gravity=
"center"
android
:text=
"
跑马灯效果,点击暂停,再点击恢复
"/> <
TextView
android
:layout_width=
"match_parent"
android
:layout_height=
"wrap_content"
android
:id=
"@+id/tv_marquee"
android
:layout_marginTop=
"20dp"
android
:singleLine=
"true"
android
:ellipsize=
"marquee"
android
:focusable=
"false"
android
:focusableInTouchMode=
"true"
android
:textColor=
"#000000"
android
:textSize=
"17sp"
android
:text=
"
快讯:红色预警,超强台风
“
莫兰蒂
”
即将登陆,请居民关紧门窗、备足粮草,做好防汛救灾准备!
"/>
1
2
3/*layout_weight指定当前视图的宽或高占上级线性布局的权重, 当指定当前视图在宽度上占的权重,layout_width需设置为0dp; 高上占的权重时,layout_height需设置为0dp*/
复制代码
1//singelLine文字单行显示,focusable是否获得焦点,focusableInTouchMode指定触摸时是否获得焦点
//ellipsize指定文本超出范围后的显示方式,marquee跑马灯显示
复制代码
1</LinearLayout>
最后
以上就是典雅红牛最近收集整理的关于第二天的全部内容,更多相关第二天内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复