Android Studio实现文字跑马灯效果

TextView

<TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/y_shiju"
        android:singleLine="true"
        android:textSize="30sp"
        android:shadowColor="@color/black"
        android:shadowDx="5.0"
        android:shadowDy="5.0"
        android:shadowRadius="3.0"
        android:ellipsize="marquee"
        android:focusable="true"
        android:focusableInTouchMode="true"
        android:marqueeRepeatLimit="marquee_forever"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"><requestFocus/>
</
TextView>

文字阴影效果

android:shadowColor="@color/black"
android:shadowDx="5.0"
android:shadowDy="5.0"
android:shadowRadius="3.0"

跑马灯设置

android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"

获取焦点

android:focusable="true"
android:focusableInTouchMode="true"
<requestFocus/>

 

posted @ 2022-02-01 14:10  富瑞阿得  阅读(318)  评论(0编辑  收藏  举报