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.在这种情况下,选取框仍然可以工作,只是在文本结束后和开始再次显示文本之前它将有一些空白. (想想数字招牌,在显示一个项目之前,它们在显示屏上有一些间隙.)

相关文章

Android性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...