
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出窗口所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)