gpt4 book ai didi

android - 字幕 TextView 动画

转载 作者:太空宇宙 更新时间:2023-11-03 11:53:06 36 4
gpt4 key购买 nike

跑马灯动画不行,这是我做的。

<LinearLayout android:layout_height="wrap_content"
android:layout_width="wrap_content" android:background="@drawable/bg_trans"
android:layout_alignParentBottom="true" android:orientation="vertical">

<TextView android:id="@+id/trackName"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:textColor="@android:color/white" android:textSize="18sp"
android:maxLines="2" android:ellipsize="marquee"
android:scrollHorizontally="true"
android:focusable="true" android:focusableInTouchMode="true"
android:marqueeRepeatLimit="marquee_forever"
android:layout_gravity="center_horizontal" />

<TextView android:id="@+id/artistName"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:textColor="@android:color/white" android:textSize="18sp"
android:maxLines="2" android:ellipsize="marquee"
android:scrollHorizontally="true"
android:focusable="true" android:focusableInTouchMode="true"
android:marqueeRepeatLimit="marquee_forever"
android:layout_gravity="center_horizontal" />
</LinearLayout>

它适用于第一个 TextView ,但不适用于第二个。我究竟做错了什么?

最佳答案

这对我有用 -

<TextView 
android:id="@+id/capture_mode"
android:layout_width="200px"
android:layout_height="wrap_content"
android:text="This is a test of marquee on the text view in android."
android:ellipsize="marquee"
android:scrollHorizontally="true"
android:singleLine="true"
android:focusable="true"
android:focusableInTouchMode="true"
android:marqueeRepeatLimit="marquee_forever"
/>

字段 marqueeRepeatLimit 将设置重复次数。

更新: TextView 的宽度需要硬编码为特定值,您可以将其设置为wrap_content。在这种情况下,选取框仍然可以工作,只是在文本结束之后和再次开始显示文本之前会有一些空白。 (想想数字标牌,在显示下一个项目之前,它们在显示屏上有一些间隙。)

关于android - 字幕 TextView 动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6733597/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com