4
I would like to know how to create a Alert Dialog customized where you had an Imageview containing a GIF.
On my Main.
imgAndroid = (Button) findViewByid (R.id.imagandroid);
imgAndroid.setBackgroundResource (R.drawable.imagee);
anime = (AnimationDrawable) imgAndroid.getBackground;
anime.start();
I created 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();
}
You can post the layout code
dialoggif
? And what is the problem that is occurring?– E.Thomas
Application at error start and is not executed.
– sergiopm
Can post some description of the error?
– E.Thomas