Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use Android to imitate Wechat network load pop-up box

Shulou Source: shulou.com Published: 2022-06-03 09:21:10 09月11日 Update

This article is about how to use Android to imitate Wechat network to load pop-up boxes. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

1. Customize the style style of view

@ color/colorPrimary @ color/colorPrimaryDark @ color/colorAccent @ null true false true @ drawable/dialog_custom_bg false 0.6

2.dialog_custom_bg loads animated shape background image (under the drawable folder)

3.indeterminate_drawable progress bar blurred background image (under the drawable folder)

4. Load the background of the dialog box

5.CustomDialog Custom Control

Public class CustomDialog extends Dialog {private String content; public CustomDialog (Context context, String content) {super (context, R.style.CustomDialog); this.content=content; initView ();} @ Override public boolean onKeyDown (int keyCode, KeyEvent event) {switch (keyCode) {case KeyEvent.KEYCODE_BACK: if (CustomDialog.this.isShowing ()) CustomDialog.this.dismiss (); break;} return true;} private void initView () {setContentView (R.layout.dialog_view) ((TextView) findViewById (R.id.tvcontent)) .setText (content); setCanceledOnTouchOutside (true); WindowManager.LayoutParams attributes = getWindow () .getAttributes (); attributes.alpha=0.8f; getWindow () .setAttributes (attributes); setCancelable (false);}}

Call directly in 6.Activity

CustomDialog customDialog = new CustomDialog (this, "loading..."); customDialog.show (); / / display, the page is not clickable when displayed, only click to return to customDialog.dismiss (); / / disappear

Thank you for reading! This is the end of the article on "how to use Android to imitate the Wechat network load pop-up box". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Tags: Background network content files folders more articles good practical animation dialog boxes controls articles styles being see knowledge progress pages references Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information Linux NVidia MariaDB Xiaomi