Android 自定义AlertDialog
来源:互联网 发布:鹊桥 淘宝客 区别 编辑:程序博客网 时间:2024/06/03 21:53
自定义AlertDialog ContentView、Position
效果图:
代码:
public void showCustomDialog(){ LinearLayout customView = new CustomDialogView(this); AlertDialog mDialog = new AlertDialog.Builder(this,R.style.DialogAtBottom) .setView(customView) .setTitle(null) .create(); Window window = mDialog.getWindow(); WindowManager.LayoutParams lp = window.getAttributes(); window.setGravity(Gravity.BOTTOM); window.setAttributes(lp); mDialog.show(); }
<style name="Animation.Dialog.ShowAtBottom" parent="android:Animation"> <item name="android:windowEnterAnimation">@anim/slide_in_from_bottom</item> <item name="android:windowExitAnimation">@anim/slide_out_from_bottom</item> </style> <style name="DialogAtBottom" > <item name="android:windowBackground">@drawable/dialog_show_at_bottom</item> <item name="android:windowMinWidthMajor">100%</item> <item name="android:windowMinWidthMinor">100%</item> <item name="android:windowIsFloating">true</item> <item name="android:windowAnimationStyle">@style/Animation.Dialog.ShowAtBottom</item> </style>
dialog_show_at_bottom.xml
<?xml version="1.0" encoding="utf-8"?><inset xmlns:android="http://schemas.android.com/apk/res/android" > <shape android:shape="rectangle"> <corners android:radius="1dp" /> <solid android:color="#ffffff" /> </shape></inset>
slide_in_from_bottom.xml
<?xml version="1.0" encoding="utf-8"?><translate xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/decelerate_interpolator" android:fromYDelta="50%p" android:toYDelta="0" android:duration="150"/>
slide_out_from_bottom.xml
<?xml version="1.0" encoding="utf-8"?><translate xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator" android:fromYDelta="0" android:toYDelta="50%p" android:duration="150"/>
AlertDialog实现旋转屏幕不消失
在AndroidManifest activity中加入下面设置
android:configChanges="keyboardHidden|orientation|screenSize"
据说2.3及以下的版本只需要
orientation|keyboardHidden
即可。
0 0
- android 之自定义 AlertDialog
- android Alertdialog 自定义
- android AlertDialog自定义大小
- Android自定义AlertDialog组件
- android AlertDialog自定义布局
- 【Android】自定义AlertDialog布局
- Android 自定义AlertDialog
- 【Android开发】自定义AlertDialog
- android自定义AlertDialog
- Android 自定义AlertDialog对话框
- android自定义AlertDialog
- Android之AlertDialog自定义
- android,Alertdialog,自定义对话框
- Android--自定义对话框--AlertDialog
- Android 自定义AlertDialog
- Android自定义AlertDialog样式
- Android AlertDialog自定义布局
- android自定义AlertDialog
- $(document).ready()与$(window).load()的区别
- PHP 利用SMPT服务器发送邮件 无需自己配置服务器
- sdut oj2128 树结构练习——排序二叉树的中序遍历
- 不让bat文件运行命令结束后cmd窗口自动关闭
- Go语言编程(十五)之接口
- Android 自定义AlertDialog
- android socke实时视频传输
- ionic之ion-slide-box实现图片轮播
- 恢复误删除的git stash记录 (how to retrieve a deleted git stash)
- Xutils 3.0 的用法,断点续传下载
- 浅谈协方差矩阵
- Mysql 在Mac中的安装和使用
- docker
- Objective-c 简单的类的声明、实现与使用