android 弹出全局加载等待动画

   /**
     * 弹出loading动画
     */
    public static void showLoading(Activity activity) {
        View popView = activity.getLayoutInflater().inflate(R.layout.pop_loading_layout, null, false);
        //运行动画
        ((AnimationDrawable) (popView.findViewById(R.id.carAnim)).getBackground()).start();

        loading = new PopupWindow(popView,
                ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT);
        loading.setTouchable(true);
        loading.setOutsideTouchable(false);
        loading.setBackgroundDrawable(null);
     //获取Activity的内容页        
     loading.showAtLocation(activity.getWindow().getDecorView().findViewById(android.R.id.content), Gravity.START | Gravity.TOP, 0, 0); loading.update(); }

  

posted on 2016-01-28 16:41  Sun_Yang_  阅读(6628)  评论(0编辑  收藏  举报

导航