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 @   富瑞阿得  阅读(325)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 25岁的心里话
· 按钮权限的设计及实现
点击右上角即可分享
微信分享提示