国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統(tǒng) > Android > 正文

Android TextView Marquee的應(yīng)用實例詳解

2019-10-22 18:31:11
字體:
供稿:網(wǎng)友

Android TextView Marquee的應(yīng)用實例詳解

親測可能。直接上代碼。

Xml代碼

<TextView   android:id="@+id/toolbar_title"   android:layout_width="match_parent"   android:layout_height="wrap_content"   android:layout_gravity="center_vertical"   android:fadingEdge="none"   android:focusable="true"   android:focusableInTouchMode="true"   android:freezesText="true"   android:ellipsize="marquee"   android:marqueeRepeatLimit="marquee_forever"   android:singleLine="true"   android:scrollHorizontally="true"   android:textColor="#fff"   android:textSize="16sp" /> 
mToolbarTitle.setSelected(true); 

說明:

XML 中以下幾行是必須的:

android:ellipsize="marquee" android:marqueeRepeatLimit="marquee_forever" android:singleLine="true" 

最后別忘了,JAVA 中還需要調(diào)用 TextView 的 setSelected(true) 方法。

特別注意:

目前發(fā)現(xiàn),android:singleLine="true" 這種寫法需要已經(jīng)被廢棄了,但是目前只能這么寫 Marquee 才能生效。如果換成最新的寫法 android:maxLines="1",你會發(fā)現(xiàn),Marquee 并不能滾動。不知道為什么。如果有知道原因的,或者有更好的寫法的,

以上就是Android TextView Marquee的實例詳解,如有疑問請留言或者到本站社區(qū)交流討論,感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!


注:相關(guān)教程知識閱讀請移步到Android開發(fā)頻道。
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 广河县| 鹤山市| 拉萨市| 朝阳区| 灵寿县| 北宁市| 武宁县| 宁远县| 辰溪县| 黄陵县| 扎赉特旗| 磐安县| 洮南市| 乌海市| 万载县| 丹寨县| 辽中县| 大名县| 西宁市| 当雄县| 永康市| 兰溪市| 桓台县| 交口县| 秀山| 龙井市| 遂宁市| 通城县| 化隆| 南靖县| 和龙市| 开阳县| 宜阳县| 金秀| 章丘市| 武胜县| 文登市| 辽宁省| 沙河市| 体育| 商洛市|