Android自定义对话框
来源:互联网 发布:重庆编程培训 编辑:程序博客网 时间:2024/06/11 23:05
1. 首先书写自定义对话框的布局文件,这里就不贴代码了,写出来原始的样式是这样的
2. 在style中继承原本的Dialog样式,可以改变一些自己想要的效果。
<style name="mydialog" parent="android:style/Theme.Dialog"> <item name="android:windowBackground">@android:color/transparent</item> <item name="android:windowNoTitle">true</item> <item name="android:shape">rectangle</item> </style>
- 这里我把背景设置成了透明色,是因为我在对话框最外层的LinerLayout中增加了一个自定义的背景
3. input_bg其实是一个xml文件,让我们来看一看
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <corners android:radius="10dp"/> <solid android:color="#FFFFFF" /> <stroke android:width="1dip" android:color="@color/colorPrimary"/> </shape>
- 实现的是一个长方形有圆角的shape
4.接着就和初始化一个Activity Fragment一样实现一个继承Dialog的类就好了
5. 调用方法
实现结果
- 一个漂亮的自定义对话框
阅读全文
0 0
- android中的对话框:自定义对话框
- Android Dialog( 自定义对话框)
- android 自定义对话框
- android自定义对话框
- Android自定义对话框
- android 自定义对话框
- Android自定义Dialog对话框
- android自定义大小对话框
- android自定义对话框
- Android自定义对话框
- android 自定义对话框
- android 自定义对话框
- android自定义对话框
- android 自定义对话框动画
- Android弹出自定义对话框
- android自定义对话框
- android 自定义对话框
- Android自定义对话框
- 薪资加五百不是梦!教你如何运用PHP自动加载
- 函数指针--c++随笔
- 友元/C++
- 数据控制语言DCL
- HTML笔记
- Android自定义对话框
- 《Kotlin精讲》-第1章(1)开发环境&第一个Kotlin程序
- python3 爬虫入门(三)正则表达式基本使用
- 使用input file 通过ajax 上传文件中onChange事件只触发一次问题
- java使double/float保留两位小数的多方法 java保留两位小数
- 大数据学习第一章 linux环境的安装配置
- Win10和Ubuntu的引导修复,Ubuntu引导Win10
- Jsoup解决跨域请求----示例java版
- thymeleaf th:text 不显示标签