Android实现自定义AlertDialog的自下向上的动画效果(并消除dialog边框)
来源:互联网 发布:外汇的算法 编辑:程序博客网 时间:2024/06/05 19:44
话不多说,直接上代码:
AlertDialog.Builder builder = new Builder(HomeActivity.this);View view = View.inflate(HomeActivity.this, R.layout.home_add_dialog, null);btn_add_cancel = (Button) view.findViewById(R.id.btn_add_cancel);builder.setView(view);dialog = builder.create();//消除dialog黑色边框dialog.setView(view,0,0,0,0);dialog.show();//overridePendingTransition(R.anim.hor_tran_in, R.anim.hor_tran_out);//设置大小 WindowManager.LayoutParams layoutParams = dialog.getWindow().getAttributes(); layoutParams.width = LayoutParams.MATCH_PARENT; layoutParams.height = LayoutParams.MATCH_PARENT; dialog.getWindow().setAttributes(layoutParams); //设置dialog进入的动画效果 <span style="color:#33ff33;"> Window window = dialog.getWindow(); window.setWindowAnimations(R.style.mystyle);</span>
先在图片对应values/styles.xml中新建个style,名称为mystyle:
<style name="mystyle" parent="android:Animation"> <item name="@android:windowEnterAnimation">@anim/ver_tran_in</item> <item name="@android:windowExitAnimation">@anim/ver_tran_out</item> </style>
而其中的anim/ver_tran_in内容如下:
<?xml version="1.0" encoding="utf-8"?><translate xmlns:android="http://schemas.android.com/apk/res/android" android:duration="500" android:fromXDelta="0" android:toXDelta="0" android:fromYDelta="80%p" android:toYDelta="0" > </translate>
anim/ver_tran_out内容:
<?xml version="1.0" encoding="utf-8"?><translate xmlns:android="http://schemas.android.com/apk/res/android" android:duration="500" android:fromXDelta="0" android:toXDelta="0" android:fromYDelta="0" android:toYDelta="-100%p" > </translate>
1 0
- Android实现自定义AlertDialog的自下向上的动画效果(并消除dialog边框)
- Android中自定义Dialog对话框消除边距消除黑边框和显示动画
- 自定义Dialog对话框并实现从底部弹出的动画效果
- Android 自定义dialog,去除系统默认黑色背景,边框并设置dialog的显示位置
- Android 去掉自定义dialog的白色边框
- Android 去掉自定义dialog的白色边框
- Android 自定义AlertDialog的实现
- 如何消除自定义AlertDialog圆角化的阴影或者黑色边框
- Android 自定义AlertDialog并通过AlertDialog修改TextView的值
- android 自定义dialog的实现(自定义大小、去除黑色边框等)
- spots-dialog:移动加载提示的自定义Android AlertDialog
- 在Android动画基础上实现自定义的动画效果
- Dialog消除自带背景边框
- 自定义dialog 边框的问题
- Android自定义Dialog实现弹出它的Activity背景变暗,并自定义Dialog的大小
- js实现div整块向上移动的动画效果
- android 自定义dialog 带动画的
- Android自定义底部带有动画的Dialog
- hdu4407 Sum(容斥原理)
- 解题报告 之 SOJ2714 Mountains(II)
- 死锁
- C# + Xamarin 开发应用-- Call API时遇到错误: Error: NameResolutionFailure
- java 死锁及避免死锁
- Android实现自定义AlertDialog的自下向上的动画效果(并消除dialog边框)
- Test
- 自制操作系统-最简单的系统hello World
- data-type,data-value
- LeetCode 208 - Implement Trie (Prefix Tree)
- HTML+css+JavaScript
- GridView分页的实现以及自定义分页样式功能实例
- vim 的:x和:wq
- Symetrict Tree / Same Tree - LeetCode