public class WholeDialog extends Dialog { private final TextView textView; public WholeDialog(@NonNull Context context) { super(context); setContentView(R.layout.loading_view); textView = (TextView) findViewById(R.id.dialog_tv); init(); } public void init(){ setCancelable(false); setCanceledOnTouchOutside(false); getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); Window window = getWindow(); WindowManager.LayoutParams attributes = window.getAttributes(); attributes.gravity = Gravity.CENTER; window.setAttributes(attributes); } public WholeDialog setMessage(String s){ textView.setText(s); return this; } }
全局dialog
最新推荐文章于 2022-08-31 15:32:54 发布