1.TextView一个很有趣的实践就是做跑马灯
代码如下:
单词解释 ellipsis:省略 marquee:跑马灯
1 <TextView 2 android:id="@+id/TextView1" 3 android:layout_width="fill_parent" 4 android:layout_height="wrap_content" 5 android:text="我是一个中国人,我应该自立自强,不断提高自身知识水平和文化素养" 6 android:singleLine="true" 7 android:ellipsize="marquee" 8 android:focusable="true" 9 android:focusableInTouchMode="true" 10 />
代码解释
首先第六行,我们设置单行显示,于是产生了多余的文字,所以我们需要设置省略的方式
紧接着我们把省略设置为跑马灯(不是跑马灯时,可设置省略号的位置在start,center,end)
开启TextView的可获取焦点(默认是关闭的)
欢迎来到我的IT天堂