How to customize the prompt effect of pop-up window by Android
This article mainly explains "Android how to customize the pop-up window prompt effect", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "Android how to customize the pop-up window prompt effect" bar!
This article example for you to share the Android custom pop-up window prompt specific code, for your reference, the specific content is as follows
Java file:
Private void showSetDeBugDialog () {AlertDialog.Builder setDeBugDialog = new AlertDialog.Builder (this); / / get the interface View dialogView = LayoutInflater.from (this) .propagate (R.layout.system_admin_psw_alert_dialog, null); / / fill the interface into the AlertDiaLog container and remove the frame setDeBugDialog.setView (dialogView,0,0,0,0) / / initialize the control TextView but_cancel = dialogView.findViewById (R.id.but_cancel); TextView but_confirm = dialogView.findViewById (R.id.but_confirm); / / cancel clicking on the external vanishing window setDeBugDialog.setCancelable (false); / / create AlertDiaLog setDeBugDialog.create (); / / AlertDiaLog display final AlertDialog customAlert = setDeBugDialog.show () / / set the AlertDiaLog width and height attribute / / WindowManager.LayoutParams params = Objects.requireNonNull (customAlert.getWindow ()). GetAttributes (); / / params.width = 200 / params.height = 200 / customAlert.getWindow (). SetAttributes (params); / / remove the decorview background color Objects.requireNonNull (customAlert.getWindow ()). SetBackground (null) of dialog / / set the click event logic but_cancel.setOnClickListener of the custom interface (new View.OnClickListener () {@ Override public void onClick (View view) {customAlert.dismiss ();}}) But_confirm.setOnClickListener (new View.OnClickListener () {@ Override public void onClick (View view) {customAlert.dismiss ();}});}
Layout file:
Resource files:
Background style
At this point, I believe that everyone on the "Android how to customize the pop-up window prompt effect" have a deeper understanding, might as well to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!