android窗口退出动画,如何在Android中为弹出窗口制作动画
PopupWindow自定義布局更方便,并且顯示位置自由,沒有任何限制。使用下面的代碼并享受動畫。在此動畫中,使用底部滑入和滑出,但是您只能更改滑入/滑出動畫,并根據(jù)您的動畫對應(yīng)用程序中的任何位置進行動畫處理,并且還需要根據(jù)自己的動畫進行動畫處理,您必須更改重力->>底部,頂部等。
動畫資源文件夾:
1.slide_in_bottom.xml
android:shareInterpolator="false"
>
android:duration="@integer/dialogplus_animation_default_duration"
android:fromXDelta="0%"
android:fromYDelta="100%"
android:toXDelta="0%"
android:toYDelta="0%"
/>
2.slide_out_bottom.xml:
android:shareInterpolator="false"
>
android:duration="@integer/dialogplus_animation_default_duration"
android:fromXDelta="0%"
android:fromYDelta="0%"
android:toXDelta="0%"
android:toYDelta="100%"
/>
樣式:
@anim/slide_in_bottom
@anim/slide_out_bottom
方法:
private PopupWindow showOptions(Context mcon){
try{
LayoutInflater inflater = (LayoutInflater) mcon.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.popup_option_documents_type,null);
PopupWindow optionspu = new PopupWindow(layout, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
optionspu.setAnimationStyle(R.style.popup_window_animation);
optionspu.setBackgroundDrawable(new ColorDrawable(Color.WHITE));
optionspu.setFocusable(true);
optionspu.setOutsideTouchable(true);
optionspu.update(0, 0, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
optionspu.showAtLocation(layout, Gravity.BOTTOM, 0, 0);
return optionspu;
}
catch (Exception e){e.printStackTrace();
return null;}
}
總結(jié)
以上是生活随笔為你收集整理的android窗口退出动画,如何在Android中为弹出窗口制作动画的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 微信网名标点符号
- 下一篇: android上传本地图片到服务器上,A