AndroidTextViewMarquee的應(yīng)用實(shí)例詳解

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

在吉安等地區(qū),都構(gòu)建了全面的區(qū)域性戰(zhàn)略布局,加強(qiáng)發(fā)展的系統(tǒng)性、市場(chǎng)前瞻性、產(chǎn)品創(chuàng)新能力,以專注、極致的服務(wù)理念,為客戶提供成都做網(wǎng)站、成都網(wǎng)站制作 網(wǎng)站設(shè)計(jì)制作按需網(wǎng)站開發(fā),公司網(wǎng)站建設(shè),企業(yè)網(wǎng)站建設(shè),品牌網(wǎng)站設(shè)計(jì),營(yíng)銷型網(wǎng)站,外貿(mào)營(yíng)銷網(wǎng)站建設(shè),吉安網(wǎng)站建設(shè)費(fèi)用合理。

親測(cè)可能。直接上代碼。

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); 

說(shuō)明:

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",你會(huì)發(fā)現(xiàn),Marquee 并不能滾動(dòng)。不知道為什么。如果有知道原因的,或者有更好的寫法的,

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

新聞標(biāo)題:AndroidTextViewMarquee的應(yīng)用實(shí)例詳解
文章出自:http://bm7419.com/article24/pcdjje.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供做網(wǎng)站、網(wǎng)站維護(hù)、網(wǎng)頁(yè)設(shè)計(jì)公司虛擬主機(jī)、網(wǎng)站設(shè)計(jì)公司、搜索引擎優(yōu)化

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設(shè)公司