微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android – 选框文本视图动画

选框动画不起作用,这就是我所做的.

<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将设置重复次数.

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐