Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to customize the prompt effect of pop-up window by Android

2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 226

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report