自定义对话框<转>
效果如下: <ignore_js_op>
主要问题: 1.对话框黑色背景问题
一般我们使用
1
|
new AlertDialog.Builder( this ).setView(dialogView).create(); |
这样创建出来的对话框还残留了万恶的黑色边框,显然不行,于是找了下 Dialog 的方法, 没发现有设置背景的方法,好吧,百度!
从网上找到方法是 使用一个 style 构造对话框,代码
1
2
|
Dialog dialog = new Dialog( this , R.style.MyDialog); dialog.setContentView(dialogView); |
其实我们查看 AlertDialog.Builder 的源码可以知道,其内部使用了默认的 style 构造对话框
MyDialog style 如下:
01
02
03
04
05
06
07
08
09
10
11
12
|
< style name = "MyDialog" parent = "@android:Theme.Dialog" > < item name = "android:windowIsFloating" >true</ item > < item name = "android:windowContentOverlay" >@null</ item > < item name = "android:windowFrame" >@null</ item > < item name = "android:windowTitleStyle" >@null</ item > < item name = "android:windowAnimationStyle" >@android:style/Animation.Dialog</ item > < item name = "android:windowSoftInputMode" >stateUnspecified|adjustPan</ item > < item name = "android:backgroundDimEnabled" >false</ item > < item name = "android:background" >@android:color/transparent</ item > < item name = "android:windowNoTitle" >true</ item > < item name = "android:windowBackground" >@android:color/transparent</ item > </ style > |
附上源码: <ignore_js_op> 对话框.zip (872.56 KB, 下载次数: 1086)
原帖地址:http://www.apkbus.com/forum.php?mod=viewthread&tid=97170&extra=&ordertype=1&page=1
自定义对话框<转>的更多相关文章
- Android—关于自定义对话框的工具类
开发中有很多地方会用到自定义对话框,为了避免不必要的城府代码,在此总结出一个工具类. 弹出对话框的地方很多,但是都大同小异,不同无非就是提示内容或者图片不同,下面这个类是将提示内容和图片放到了自定义函 ...
- Android中的AlertDialog使用示例五(自定义对话框)
在Android开发中,我们经常会需要在Android界面上弹出一些对话框,比如询问用户或者让用户选择.这些功能我们叫它Android Dialog对话框,AlertDialog实现方法为建造者模式. ...
- jquery自定义对话框alert、confirm和prompt
jQuery Alert Dialogs,又一个基于jQuery的提示框插件,主要包括Alert.Confirm.prompt这三种,还有一个高级范例,可以在提示框内嵌入HTML语言,可以自定义风格样 ...
- Android自定义对话框
在android中有自带的对话框,为了美观,很多开发者会使用自定义对话框,如下图: 点击“弹出自定义对话框按钮后”显示如图效果. 首先要自己定义一个xml文件定义自己对话框的样式: <?xml ...
- Android项目实战(七):Dialog主题Activity实现自定义对话框效果
想必大家都用过Dialog主题的Activity吧,用它来显示自定义对话框效果绝对是一个非常不错的选择. 即把activity交互界面以Dialog的形式展现出来,Dialog主题的Activity大 ...
- 炫酷JQUERY自定义对话框插件JDIALOG_JDIALOG弹出对话框和确认对话框插件
多种类型自定义对话框插件jDialog是一款基于jquery实现的轻量级多种类型的自定义对话框插件 在项目开发中.一般会美化 alert(); 的样式.那么今天我就和大家分享一款非常炫的插件 先来看一 ...
- Android 自定义对话框
Android实现自定义对话框效果: 核心代码: package com.example.diydialog; import android.os.Bundle; import android.app ...
- android继承Dialog实现自定义对话框
有时需要自定义对话框,可以使用AlterDialog.Bulider,比如下面的代码片段 new AlertDialog.Builder(self) .setTitle("标题") ...
- 关于JFace的自定义对话框(Dialog类)
仅仅是使用MessageDialog,InputDialog等JFace中现成的对话框类是无法满足实际项目开发需要的. 很多时候都需要自己定制对话框,自定义对话框只要在Dialog类的基础上作扩展就行 ...
- android创建自定义对话框
创建如下自定义对话框: JAVA代码 LayoutInflater li = LayoutInflater.from(TagActivity. this); //NOTE final View Te ...
随机推荐
- Linux命令四
作业一: 1) 开启Linux系统前添加一块大小为20G的SCSI硬盘 2) 开启系统,右击桌面,打开终端 安装的是命令行界面 3) 为新加的硬盘分区,一个主分区大小为10G,剩余空间给扩展分区,在扩 ...
- switch遇到0的问题
你是否经常有switch来代替if else?是否因为使用了switch,提高代码的执行效率而庆幸?好吧,你和我一样,但也许你没有遇到下面的问题. 这个小程序,会输出什么呢?会是'00'么? 结果 ...
- BAT级别对照表
- VSCode打开文件总是会覆盖上次打开的标签
在使用VSCode的时候,打开一个文件之后,如果没有修改的话,那么再打开下一个文件的时候,他总会替换上次打开的标签,那么怎么样才能每次都在新的标签打开文件呢? 实际上,这种情况的出现是因为我们点击文件 ...
- 怎么把openrety 里边的 table 优雅的打印出来
1.安装 loarocks 库以后 2.安装 Penlight 插件 3.如下图所示 4.利用dump 函数优雅的打印 table
- HDU - 6241 :Color a Tree(不错的二分)
Bob intends to color the nodes of a tree with a pen. The tree consists of NN nodes. These nodes are ...
- 51nod 2006 飞行员配对
第二次世界大战时期,英国皇家空军从沦陷国征募了大量外籍飞行员.由皇家空军派出的每一架飞机都需要配备在航行技能和语言上能互相配合的2名飞行员,其中1名是英国飞行员,另1名是外籍飞行员.在众多的飞行员中, ...
- fn project 对象模型
Applications At the root of everything are applications. In fn, an application is essentially a grou ...
- ③SpringBoot中Redis的使用
本文基于前面的springBoot系列文章进行学习,主要介绍redis的使用. SpringBoot对常用的数据库支持外,对NoSQL 数据库也进行了封装自动化. redis介绍 Redis是目前业界 ...
- stp 零部件 转为 装配图
stp 零部件 转为 装配图 起因 由于收到的 stp 为零件件,这时如果输出 eDrawings 文件时是没有装配结构的. 解决 打开 stp 后在资源管理器中有一个实体的文件夹,点右键保存实体. ...