布局:

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

 

相关文章:

  • 2022-12-23
  • 2021-12-08
  • 2021-07-18
  • 2021-07-06
  • 2022-12-23
  • 2021-07-14
  • 2021-05-26
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-05-07
  • 2022-01-23
  • 2021-07-14
相关资源
相似解决方案