final Dialog customDialog = new Dialog(this);

customDialog.setTitle(R.string.attention);

customDialog.setContentView(R.layout.connectionview);

ImageView image = (ImageView)customDialog.findViewById(R.id.anim);

image.setBackgroundResource(R.drawable.connection);

customDialog.setOnShowListener(new DialogInterface.OnShowListener(){

  public void onShow(android.content.DialogInterface dialog){

    ImageView image =(ImageView)customDialog.findViewById(R.id.anim);

    AnimationDrawable ad = (AnimationDrawable)image.getBackground();

    if(ad != null) {
  
    ad.start();

  }

}

});



customDialog.show();



这里利用的onShowListener,注意这个接口需要高版本的SDK。

 

相关文章:

  • 2021-10-29
  • 2021-09-27
  • 2022-12-23
  • 2021-10-30
  • 2021-07-03
  • 2021-10-12
  • 2022-12-23
  • 2021-09-10
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-15
  • 2021-04-30
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案