android - Disabling (fade in and fade out) dialog box animation -
i'm novice programmist , have problem disabling dialog box animation (fade in , fade out).
i tried to using empty style , set changing
final alertdialog.builder builder = new alertdialog.builder(getactivity());
into
final alertdialog.builder builder = new alertdialog.builder(new contextthemewrapper(getactivity(), r.style.noanimation));
background of dialog box became black, positive , negatice button changed <2.1 - 4.0) android style, fade in , fade out animation effect remained...
my style:
<style name="dialognoanimation"> <item name="android:windowenteranimation">@anim/enter</item> <item name="android:windowexitanimation">@anim/exit</item> </style> <style name="noanimation" parent="@android:style/theme.dialog"> <item name="android:windowanimationstyle">@style/dialognoanimation</item> </style>
any ideas how can eliminate animation?
finally success!
res/anim/enter.xml
<?xml version="1.0" encoding="utf-8"?> <translate xmlns:android="http://schemas.android.com/apk/res/android" android:duration="@android:integer/config_shortanimtime"/>
res/anim/exit.xml
<?xml version="1.0" encoding="utf-8"?> <translate xmlns:android="http://schemas.android.com/apk/res/android" android:duration="@android:integer/config_shortanimtime"/>
res/values/styles.xml
<style name="dialognoanimation"> <item name="android:windowenteranimation">@anim/enter</item> <item name="android:windowexitanimation">@anim/exit</item> </style>
src/[dialog_box_class].java
@override public void onstart() { super.onstart(); if (getdialog() == null) return; getdialog().getwindow().setwindowanimations(r.style.dialognoanimation); }
Comments
Post a Comment