I am building a custom ProgressDialog and would like for the background Activity to fade faster and darker than 开发者_如何转开发default. The only problem is I do not know where to look for the animation that handles the fading for a ProgressDialog. I have worked my way upstream from ProgressDialog -> AlertDialog -> Dialog but dont see anything in the java that looks useful. I am assuming there is an animation .xml file that controls it, so I am looking for that file, and how the calling program makes use of it.
Just to be a little more clear, the animation I am refering to is when a ProgressDialog pops up, the previously active activity fades to dark. I want to gain control of that animation.
The only ways I know of to alter the background dimming are via the android:backgroundDimEnabled and android:backgroundDimAmount settings (to completely turn on/off the background dimming and to control the amount of background dimming, respectively)
To alter these values, create (or edit) your res/values/styles.xml file with the following
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.ControlledDim" parent="android:Theme">
<item name="android:backgroundDimAmount">0.2</item>
</style>
</resources>
And apply that theme in the activity's manifest by setting the theme to
@style/Theme.ControlledDim
This may not offer as much control as you'd like but is hopefully a step in the right direction
(The default setting for android:backgroundDimAmount is 0.6)
精彩评论