设置TextView的衰落的Andr​​oid 4.0.3 [英] Set textview fading in Android 4.0.3

查看:144
本文介绍了设置TextView的衰落的Andr​​oid 4.0.3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想实现的Andr​​oid 4.0.3淡入淡出效果的TextView ;但是,这是行不通的。

I've just tried to implement the fade effect for TextView in Android 4.0.3; however, it doesn't work.

fadingEdge="horizontal"
singleLine="true"
ellipsize="marquee"

这code完全适用于2.3.7及以下,但不工作的4.0.3。 我不知道为什么会这样呢?以及如何淡入淡出效果的TextView

This code works perfectly for 2.3.7 and below, but not working for 4.0.3. I'm wondering why is that so? and how to make fade effect for TextView?

我的问题是一样的这一个:<一href="http://groups.google.com/group/android-developers/browse_thread/thread/97131b20de8b2ebd">http://groups.google.com/group/android-developers/browse_thread/thread/97131b20de8b2ebd ,但没有答案。

My question is the same as this one: http://groups.google.com/group/android-developers/browse_thread/thread/97131b20de8b2ebd , but no answer yet.

推荐答案

这是一个有点晚,但可以帮助人们谁拥有了同样的问题。

It is a bit late, but that may help people who have the same question.

我已经对不同的手机这个问题,它可能来自是:

I have had this problem on different phones, and it could come from that :

  • 在Android 4.0.x的,似乎TextView的必须要成为焦点,否则褪色效果将无法正常工作。因此,尝试添加这样的:

  • on Android 4.0.x, it seems that the TextView have to be focusable, otherwise fade effect won't work. So try adding this :

机器人:可调焦=真 机器人:focusableInTouchMode =真正的

android:focusable="true" android:focusableInTouchMode="true"

如果不工作,你可以尝试机器人:行=1,但我认为,安卓SINGLELINE =真,这是德precated,效果更好

if that does not work, you could try android:lines="1", but i think that android:singleLine="true", which is deprecated, works better

有时候,你需要以编程方式调用的setSelected(真)上的TextView得到淡入淡出效果。请检查此链接:<一href="http://stackoverflow.com/questions/1827751/is-there-a-way-to-make-ellipsize-marquee-always-scroll">Is有没有办法让ellipsize =&QUOT;字幕&QUOT;一直滚动?

sometimes, you need to programmatically call setSelected(true) on the textView to get the fade effect. Please check this link : Is there a way to make ellipsize="marquee" always scroll?

这篇关于设置TextView的衰落的Andr​​oid 4.0.3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆