当前位置:编程学习 > wap >>

为什么这个动画显示不出来呢???????

是在一直悬浮窗口的动画


private void moveOnTop(int which) {
if (topView == null) {
LayoutInflater layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
topView = layoutInflater.inflate(R.layout.topmove, null);
topLayout = (RelativeLayout) topView.findViewById(R.id.widget32);
topDisplay = (ImageView) topView.findViewById(R.id.topimage);
topDisplay.setScaleType(ImageView.ScaleType.FIT_XY);
getWindow().getDecorView().getWindowVisibleDisplayFrame(rect);
wm = (WindowManager) getApplicationContext().getSystemService(
WINDOW_SERVICE);
params = new WindowManager.LayoutParams();
if (topView.isShown()) {
wm.removeView(topView);
}
params.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT
| WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY;
params.flags = LayoutParams.FLAG_NOT_TOUCH_MODAL
| LayoutParams.FLAG_NOT_FOCUSABLE;
params.width = 98;
params.height = 94;
params.gravity = Gravity.LEFT | Gravity.TOP;
}
params.x = xPos + (focus % 8) * 93;
params.y = yPos + (focus / 8) * 91;
topDisplay.setImageBitmap(StartTVActivity.arraylist.get(which));
wm.addView(topView, params);
topLayout.startAnimation(showTopAnim());//此处动画不能显示出来
}
--------------------编程问答-------------------- 动画的代码是这样。

private AnimationSet showTopAnim() {
AnimationSet as = new AnimationSet(false);
ScaleAnimation sa = new ScaleAnimation(2f, 1f, 2f, 1f,
Animation.RELATIVE_TO_SELF, .5f, Animation.RELATIVE_TO_SELF,
.5f);
sa.setDuration(2000);
as.addAnimation(sa);
AlphaAnimation aa = new AlphaAnimation(0.5f, 1f);
aa.setStartOffset(1000);
aa.setDuration(1000);
as.addAnimation(aa);
return as;
}
--------------------编程问答-------------------- 帮忙看看呗,
补充:移动开发 ,  Android
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,