动画系统警报类型视图 [英] Animate system alert type view
本文介绍了动画系统警报类型视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是有可能的动画系统警报类型视图?如果这是怎么了?
is it possible to animate a system alert type view? if it's how?
我试过,但没有奏效:
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
View view = new View(this);
view.setBackgroundColor(0x33FF0000);
Animation animation = AnimationUtils.loadAnimation(this, R.anim.blink);
view.startAnimation(animation);
WindowManager windowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(-1, -1, 2006, 1336, -3);
windowManager.addView(view, layoutParams);
}
blink.xml:
blink.xml:
<alpha
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:fromAlpha="0.0"
android:toAlpha="1"
android:duration="500"
android:repeatMode="reverse"
android:repeatCount="9999999"/>
这code添加视图系统,但它不是动画。
This code adds the view to the system but it's not animated.
推荐答案
我找到了一个解决方案:
I found a solution for this:
认为这将是动画不能直接添加到顶层窗口,由于Android的顶窗是不是一个真正的ViewGroup。因此视图必须加一个的ViewGroup像的FrameLayout第一然后将此ViewGroup中被添加到顶部窗口。
the view which is going to be animated must not be directly added to the top window, because top window of android is not a real ViewGroup. so the view must be added to a ViewGroup like FrameLayout first and then this ViewGroup be added to the top window.
这篇关于动画系统警报类型视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文