I made a custom class which extend by dialog. may be this will helpful for you 
public class CProgressDialog extends Dialog {
private ImageView iv;
public CProgressDialog(Context context) {
    super(context, R.style.TransparentProgressDialog);
    WindowManager.LayoutParams wlmp = getWindow().getAttributes();
    wlmp.gravity = Gravity.CENTER_HORIZONTAL;
    getWindow().setAttributes(wlmp);
    setTitle(null);
    setCancelable(false);
    setOnCancelListener(null);
    LinearLayout layout = new LinearLayout(context);
    layout.setOrientation(LinearLayout.VERTICAL);
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
            LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    iv = new ImageView(context);
    iv.setImageResource(R.drawable.spiner_green);
    layout.addView(iv, params);
    addContentView(layout, params); 
}
@Override
public void show() {
    super.show();
    RotateAnimation anim = new RotateAnimation(0.0f, 360.0f,
            Animation.RELATIVE_TO_SELF, .5f, Animation.RELATIVE_TO_SELF,
            .5f);
    anim.setInterpolator(new LinearInterpolator());
    anim.setRepeatCount(Animation.INFINITE);
    anim.setDuration(2000);
    iv.setAnimation(anim);
    iv.startAnimation(anim);
}