本文介绍了奥飞动漫不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

pretty简单:我补充一个在屏幕上动态按钮,我尝试添加后淡出出来,但动画从来不玩。后来我尝试添加它时,它已经呈现在屏幕上,但仍然一无所获。下面是code:

Pretty simple: I add a dynamic button on screen and I try to fade it out after adding, but the animation never plays. I tried adding it later when it is already rendered on the screen, but still nothing. Below is the code:

btn = new ImageButton(context);
btn.setBackgroundColor(0xFFFF0000);

params = new WindowManager.LayoutParams(
    width,height,
    WindowManager.LayoutParams.TYPE_SYSTEM_ALERT | 
    WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
    WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
    WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH |
    WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
    PixelFormat.TRANSLUCENT);
params.gravity = Gravity.TOP | Gravity.LEFT;

windowManager.addView(btn, params);

btn.startAnimation(new AlphaAnimation(1,0));

任何想法?

推荐答案

可以解释为什么你要这种奇怪的行为,如果你已经在XML中设置alpha为0。

This answer may explain why you're getting such strange behavior if you've set the alpha to 0 in xml.

这篇关于奥飞动漫不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 23:23