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();
    }
相关文章
相关标签/搜索