View myView = findViewById(R.id.myView); myView.setBackgroundColor(Color.GREEN); myView.invalidate();
ValueAnimator anim = ValueAnimator.ofFloat(0f, 1f); anim.setDuration(1000); anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { float fraction = (float) animation.getAnimatedValue(); myView.setTranslationX(fraction * 100); myView.setTranslationY(fraction * 100); myView.invalidate(); } }); anim.start();Package/Library: android.view.View is part of the Android SDK, which is included in the Android framework package.