android之Dialog相关.docx

上传人:A*** 文档编号:142724910 上传时间:2020-08-22 格式:DOCX 页数:7 大小:68KB
返回 下载 相关 举报
android之Dialog相关.docx_第1页
第1页 / 共7页
android之Dialog相关.docx_第2页
第2页 / 共7页
android之Dialog相关.docx_第3页
第3页 / 共7页
android之Dialog相关.docx_第4页
第4页 / 共7页
android之Dialog相关.docx_第5页
第5页 / 共7页
点击查看更多>>
资源描述

《android之Dialog相关.docx》由会员分享,可在线阅读,更多相关《android之Dialog相关.docx(7页珍藏版)》请在金锄头文库上搜索。

1、android之Dialog相关前言:这篇是对android相关Dialog的知识进行逐步总结。一、Dialog去掉标题栏 和边框1、自定义一个XML布局,这里以登录窗口为例:(activity_log_in.xml) 这里要注意两个地方:(1)、此XML的名字为:activity_log_in.xml(2)、对总布局进行了ID命名:android:id=+id/log_in_layout,后面在代码中转换部局时要用到这两个名字,这里先提一下。2、定义弹出窗体样式 null true false drawable/listbox null true3、代码创建窗体Dialog mDeleteD

2、ialog = new Dialog(getContext(), R.style.dialog);final LayoutInflater inflater = LayoutInflater.from(getContext();View layout = (LinearLayout) inflater.inflate(R.layout.activity_log_in, null).findViewById(R.id.log_in_layout);mDeleteDialog.setContentView(layout);mDeleteDialog.show();mDeleteDialog.get

3、Window().setGravity(Gravity.CENTER);注意一下这里利用已有XML布局创建View的过程。其中R.layout.activity_log_in就是我们的XML布局文件名,R.id.log_in_layout就是XML中的总布局LinearLayout的ID。运行结果:二、问题:android.view.WindowManager$BadTokenException: Unableto add window-tokennullisnotforan application手册上代码逻辑如下:LayoutInflater inflater = (LayoutInflater)getApplicationContext().getSystemService(LAYOUT_INFLATER_S

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > IT计算机/网络 > 其它相关文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号