Android examples for Activity:Activity Background
dim Background color
//package com.java2s; import android.animation.ValueAnimator; import android.app.Activity; import android.view.Window; import android.view.WindowManager; public class Main { public static void dimBackground(final float from, final float to, Activity context) {/* www . j ava2 s . c o m*/ final Window window = context.getWindow(); ValueAnimator valueAnimator = ValueAnimator.ofFloat(from, to); valueAnimator.setDuration(500); valueAnimator .addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { WindowManager.LayoutParams params = window .getAttributes(); params.alpha = (Float) animation.getAnimatedValue(); window.setAttributes(params); } }); valueAnimator.start(); } }