I would like to know how to create a custom Alert Dialog where you have an ImageView containing a GIF.
In my Main.
imgAndroid = (Button) findViewByid (R.id.imagandroid);
imgAndroid.setBackgroundResource (R.drawable.imagee);
anime = (AnimationDrawable) imgAndroid.getBackground;
anime.start();
Create a Drawable
<animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="false">
<item android:drawable="@drawable/play" android:duration="1000" />
<item android:drawable="@drawable/playum" android:duration="1000" />
<item android:drawable="@drawable/playdois" android:duration="1000"/>
<item android:drawable="@drawable/playtres" android:duration="1000"/>
<item android:drawable="@drawable/playquatro" android:duration="1000"/>
<item android:drawable="@drawable/playcinco" android:duration="1000"/>
</animation-list>
The code of my Alert Dialog
public void testedialog (View View){
final Dialog dialog = new Dialog(this);
dialog.setContentView(R.layout.dialoggif);
//button que leva para o menu
Button irum = (Button) dialog.findViewById(R.id.button111);
irum.setOnClickListener(new android.view.View.OnClickListener() {
@Override
public void onClick(View v) {
setContentView(R.layout.menu);
dialog.dismiss();
}
});
//button que manda para o proximo nivel
Button dialogButton = (Button) dialog.findViewById(R.id.button122);
dialogButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
setContentView(R.layout.menu);
dialog.dismiss();
}
});
dialog.show();
}