从oncreate调用androidd出窗口

从oncreate调用androidd出窗口,第1张

概述privatevoidloadingPopup(){LayoutInflaterinflater=this.getLayoutInflater();Viewlayout=inflater.inflate(R.layout.loading_dialog,null);PopupWindowwindows=newPopupWindow(layout,300,300,true);windows.setFocusab

private voID loadingPopup() {    LayoutInflater inflater = this.getLayoutInflater();          VIEw layout = inflater.inflate(R.layout.loading_dialog, null);        PopupWindow windows = new PopupWindow(layout , 300,300,true);       windows.setFocusable(false);          windows.settouchable(true);           windows.setoutsIDetouchable(true);          windows.showAtLocation(layout,Gravity.CENTER, 0, 0);}

当从oncreate()调用方法loadingPopup()时产生异常..请你能帮助我

解决方法:

您甚至在显示活动窗口之前尝试显示d出窗口.
在post方法的帮助下,我们可以等到所有必要的启动生命周期方法完成.

试试这个 :

private voID loadingPopup() {    LayoutInflater inflater = this.getLayoutInflater();    final VIEw layout = inflater.inflate(R.layout.loading_dialog, null);    final PopupWindow windows = new PopupWindow(layout , 300,300,true);    windows.setFocusable(false);    windows.settouchable(true);     windows.setoutsIDetouchable(true);    layout.post(new Runnable() {        public voID run() {            windows.showAtLocation(layout,Gravity.CENTER, 0, 0);        }    });}
总结

以上是内存溢出为你收集整理的从oncreate调用androidd出窗口全部内容,希望文章能够帮你解决从oncreate调用androidd出窗口所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1115530.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-29
下一篇2022-05-29

发表评论

登录后才能评论

评论列表(0条)

    保存