A continuación el código:
res/anim/custom_dialog.xml
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:drawable="@drawable/right"
android:duration="150"/>
<item
android:drawable="@drawable/up"
android:duration="150"/>
<item
android:drawable="@drawable/left"
android:duration="150"/>
<item
android:drawable="@drawable/down"
android:duration="150"/>
</animation-list>
activity_loading.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</RelativeLayout>
LoadingActivity.java
package com.example.blogcustomdialoanimation;
import android.app.Activity;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.view.Menu;
public class LoadingActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_loading);
ProgressDialog dialog = new ProgressDialog(this);
dialog.setIndeterminate(true);
dialog.setIndeterminateDrawable(getResources().getDrawable(R.anim.custom_dialog));
dialog.setMessage("Some Text");
dialog.show();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_loading, menu);
return true;
}
}
A continuación les dejo las imagenes:
It works!
Roger Sala,
Quan vegis el progress dialog a l'hora d'actualitzar dades d'usuari i entrar sessió a Loodic, podràs estar orgullós que he seguit el teu tutorial per fer l'animació xDDDD
ResponderEliminarMerci crack.