Android應用開發——跑馬燈效果

來源:互聯網
上載者:User

XML布局屬性介紹

android:ellipsize:設定當文字過長時,該控制項該如何顯示。有如下值設定:”start”—-省略符號顯示在開頭;”end” ——省略符號顯示在結尾;”middle”—-省略符號顯示在中間;

marquee——以跑馬燈的方式顯示(動畫橫向移動)
android:marqueeRepeatLimit在ellipsize指定marquee的情況下,設定重複滾動的次數,當設定為 marquee_forever時表示無限次。
android:focusableInTouchMode:是否在觸摸模式下獲得焦點。
android:focusable控制項是否能夠擷取焦點

 

樣本:

<TextView
  android:id="@+id/tv"
  android:autoLink="all"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:singleLine="true"    一定要設定這個屬性
  android:textSize="20sp"
  android:textColor="#00FF00"
  android:focusable="true"
  android:ellipsize="marquee"
  android:marqueeRepeatLimit="marquee_forever"
  android:focusableInTouchMode="true"
  android:text="中華人民共和國中華人民共和國中華人民共和國中華人民共和國中華人民共和國中華人民共和國中華人民共和國vvvvvvv"
  />

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.