美文网首页程序人生
Android TextView实现跑马灯效果

Android TextView实现跑马灯效果

作者: 为自己代颜_ | 来源:发表于2021-06-22 11:45 被阅读0次

直接上代码如下:

            <TextView
                android:id="@+id/tv_video_call_name"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textAlignment="center"
                android:textColor="@color/white"
                android:ellipsize="marquee"
                android:singleLine="true"
                android:focusableInTouchMode="true"
                android:paddingStart="@dimen/PX_32"
                android:paddingEnd="@dimen/PX_32"
                android:textSize="@dimen/PX_60"
                tools:text="@string/voice_call_name" />
            <requestFocus/>

解析focusableInTouchMode必须
<requestFocus/>必须
文字超过设置宽度就回自动波动

相关文章

网友评论

    本文标题:Android TextView实现跑马灯效果

    本文链接:https://www.haomeiwen.com/subject/vpwpyltx.html