android actionsheet动画
来源:互联网 发布:java cmd ant 编辑:程序博客网 时间:2024/06/01 09:37
1.首先在res/anim文件夹下创建slide_up.xml和slide_down.xml(文件名随意),代码如下:
slide_up.xml
- <set xmlns:android="http://schemas.android.com/apk/res/android"
- android:interpolator="@android:anim/accelerate_decelerate_interpolator" >
- <translate android:duration="500"
- android:fromYDelta="100%p"
- android:toYDelta="0%p" />
- </set>
slide_down.xml
- <set xmlns:android="http://schemas.android.com/apk/res/android"
- android:interpolator="@android:anim/accelerate_decelerate_interpolator">
- <translate android:duration="200"
- android:fromYDelta="0%p"
- android:toYDelta="100%p" />
- </set>
2.然后在res/values文件夹下的styleds文件(没有的话就新建一个),增加以下代码:
- <resources>
- <style name="DialogAnimation">
- <item name="android:windowEnterAnimation">@anim/slide_up</item>
- <item name="android:windowExitAnimation">@anim/slide_down</item>
- </style>
- </resources>
<item name="android:windowFrame">@null</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:backgroundDimEnabled">false</item>
<item name="android:windowBackground">@android:color/transparent</item>
</style>
3.最后,在dialog弹出之前,使用刚刚实现的动画效果:
Dialog dialog = new Dialog(mContext, R.style.mydialog);
dialog.setContentView(R.layout.dialog_camera);
LayoutParams layoutParams = dialog.getWindow().getAttributes();
layoutParams.y=10;
layoutParams.gravity = Gravity.TOP;
layoutParams.width = LayoutParams.MATCH_PARENT;
dialog.getWindow().getAttributes().windowAnimations = R.style.DialogAnimation;
dialog.show();
0 0
- android actionsheet动画
- Android ActionSheet动画效果实现
- ActionSheet
- ActionSheet
- Android 使用自定义Dialog打造ActionSheet菜单
- Android 使用自定义Dialog打造ActionSheet菜单
- 仿IOS 菜单 ActionSheet Menu For Android
- ionic actionsheet 在android下面目全非
- sencha touch 实现android手机键盘对actionsheet的操作
- Android开发技巧——实现可复用的ActionSheet菜单
- Android仿IOS底部弹出选择菜单ActionSheet
- ActionSheet 使用
- ActionSheet + Picker
- AlertView&ActionSheet
- actionsheet使用
- 仿微信ActionSheet
- 微信小程序自定义弹窗showModel模态框、Toast提示框、actionSheet底部动画弹窗(多API调用)
- Android开发技巧——使用Dialog实现仿QQ的ActionSheet菜单
- hdu 4771 Stealing Harry Potter's Precious (bfs+状态压缩)
- UIColor方法
- iOS 开源项目[我的衣橱]开发阶段3: 第三方类的使用
- tiles2配置及标签
- (Struts2,Spring,Ibatis)初步整合理解
- android actionsheet动画
- 绘制Debian软件包依赖关系图
- 链表简单操作
- PHP+MySQL分页显示示例分析
- Eclipse中提高Android SDK Manager下载速度方法
- 策略模式的扩展——策略枚举
- 用户画像数据建模方法
- Leading dimension
- HDU 5032 Always Cook Mushroom