Android TextView走馬燈效果


  布局:

 <TextView
        android:id="@+id/myTextView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ellipsize="marquee"
        android:marqueeRepeatLimit="marquee_forever"
        android:scrollHorizontally="true"
        android:singleLine="true"
        android:text="hello world my dear friend this is a long long string~~~~hello world my dear friend this is a long long string" />

  

  還需要在程序中進行控制:

        TextView mTextView = (TextView) findViewById(R.id.myTextView);

        // 開始走馬燈效果
        mTextView.setSelected(true);

        // 停止走馬燈效果
        // mTextView.setSelected(false);

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM