十年網(wǎng)站開發(fā)經(jīng)驗 + 多家企業(yè)客戶 + 靠譜的建站團隊
量身定制 + 運營維護+專業(yè)推廣+無憂售后,網(wǎng)站問題一站解決
這篇文章給大家分享的是有關(guān)如何使用Android仿微信網(wǎng)絡(luò)加載彈出框的內(nèi)容。小編覺得挺實用的,因此分享給大家做個參考,一起跟隨小編過來看看吧。
網(wǎng)站建設(shè)哪家好,找創(chuàng)新互聯(lián)公司!專注于網(wǎng)頁設(shè)計、網(wǎng)站建設(shè)、微信開發(fā)、小程序設(shè)計、集團企業(yè)網(wǎng)站建設(shè)等服務(wù)項目。為回饋新老客戶創(chuàng)新互聯(lián)還提供了濱江免費建站歡迎大家使用!
1. 自定義view的style樣式
2.dialog_custom_bg 加載動畫shape背景圖(drawable文件夾下)
3.indeterminate_drawable 進度條模糊背景圖(drawable文件夾下)
4.加載對話框的背景
5.CustomDialog自定義控件
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); }}
6.Activity中直接調(diào)用
CustomDialog customDialog = new CustomDialog(this, "正在加載...");customDialog.show();//顯示,顯示時頁面不可點擊,只能點擊返回customDialog.dismiss();//消失
感謝各位的閱讀!關(guān)于“如何使用Android仿微信網(wǎng)絡(luò)加載彈出框”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,讓大家可以學到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!