Android初学设置文字跑马灯效果

时间:2022-07-23
本文章向大家介绍Android初学设置文字跑马灯效果,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

在src/main/res/layout/activity_main.xml文件下添加以下代码

<TextView
        android:id="@+id/tv_7"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
       
        android:text="往事随风往事随风往事随风往事随风往事随风往事随风"
        android:textColor="#000000"
        android:textSize="15pt"
        android:singleLine="true"
        android:ellipsize="marquee"
        android:marqueeRepeatLimit="marquee_forever"
        tools:ignore="MissingConstraints"
        tools:layout_editor_absoluteX="40dp"
        tools:layout_editor_absoluteY="343dp"
        android:focusable="true"
        android:clickable="true"
        android:focusableInTouchMode="true"/>

效果图