I had the same problem, here is the solution: Instead of ImageView you need to add a FrameLayout that has an ImageView.
LayoutInflater inflater = (LayoutInflater) getApplicationContext().getSystemService(LAYOUT_INFLATER_SERVICE);
floatingLayout = (FrameLayout) inflater.inflate(R.layout.floating_layout, null);
Save your button to deal with animations later:
mButton = (ImageView) floatingLayout.findViewById(R.id.mButton);
When adding a button, add a layout:
windowManager.addView(floatingLayout, floatingLayoutParams);
Animate!
Animation rotate = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.rotation);
rotate.setDuration(1000);
mButton.startAnimation(rotate);