我有一个名为CardSlot的自定义视图,它是我在布局中使用两次的布局的一部分,粗略地说:
<LinearLayout>
<PlayerLayout 4 CardSlots defined... /> #Layout1
<LinearLayout 2 CardSlots defined/>
<PlayerLayout 4 CardSlots defined.../> #layout2
</LinearLayout>
WarSlot卡最初是不可见的。我这样称呼动画:
GameFragment:
public void onEvent(GameMsg msg) {
switch (msg) {
case XXX:
for (int idx = playerLayouts.length-1; idx >= 0; idx--) {
playerLayouts[idx].animateWarCard(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in));
}
break;
}
}
PlayerLayout:
public void animateWarCard(Animation animation) {//TODO why no show for layout2???
Log.v(TAG, "animate? " + mdata.player.getClass().getSimpleName());
cardSlots[WARSLOT].setAnimation(animation);
animation.setStartTime(3500);
animation.setDuration(3500);
animation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
Log.v(TAG, "onAnimationStart " + animation);
}
@Override
public void onAnimationEnd(Animation animation) {
Log.v(TAG, "onAnimationEnd " + animation);
cardSlots[WARSLOT].setVisibility(View.VISIBLE);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
animation.startNow();
Log.v(TAG, "started?");
}
现在,layout1的动画工作正常,但它不会启动layout2(没有任何监听器的日志消息显示)。即使我只是直接调用layout2并省略layout1它也行不通。我可以在日志中看到没有错误或异常,甚至是未经过滤的。
关于我应该寻找什么或以不同方式拨打电话的任何想法?