Why does my view's background change during an animation?
Simple animation; I just want something to slide away to the left.
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromXDelta="0"
android:toXDelta="-100%"
android:duration="1000"/>
</set>
I have an ExpandableListView:
<ExpandableListView android:id="@id/android:list"
开发者_如何学JAVA android:background="@android:color/transparent"
... />
To which I apply this:
ExpandableListView list = getExpandableListView();
Animation anim = AnimationUtils.loadAnimation(TvEventListActivity.this, R.anim.left);
list.startAnimation(anim);
When I start the animation, the list background, which should be transparent, changes to a solid grey background for the duration of the animation. Then it is restored to correctness.
Why does this happen? How can I prevent it?
Be sure to set your android:cacheColorHint
to transparent if a background Drawable is used or the same background color if a solid color is used.
精彩评论