1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| /** * Created by xpf on 2017/8/28 :) * Function:自定义加载中的Dialog */
public class LoadingView extends ProgressDialog {
public LoadingView(Context context) { super(context); }
public LoadingView(Context context, int theme) { super(context, theme); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); init(getContext()); }
private void init(Context context) { setCancelable(true); setCanceledOnTouchOutside(false); setContentView(R.layout.loading_view);//loading的xml文件 WindowManager.LayoutParams params = getWindow().getAttributes(); params.width = WindowManager.LayoutParams.WRAP_CONTENT; params.height = WindowManager.LayoutParams.WRAP_CONTENT; getWindow().setAttributes(params); }
@Override public void show() { // 显示Dialog super.show(); }
@Override public void dismiss() { // 关闭Dialog super.dismiss(); } }
|