问题描述
我只是想实现的Android 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
?
我的问题是一样的这一个: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得到淡入淡出效果。请检查此链接:Is有没有办法让ellipsize ="字幕"一直滚动?
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的衰落的Android 4.0.3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!