是在一直悬浮窗口的动画
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());//此处动画不能显示出来
}

解决方案 »

  1.   

    动画的代码是这样。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;
    }