Disable window and transition settings

后端 未结 1 2041
你的背包
你的背包 2021-01-16 00:35

So what I need to do is toggle window and/or transition animations on and off in code, to have the same effect of going Settings > Display > Animations > Disable all animati

相关标签:
1条回答
  • 2021-01-16 01:02

    Check you are setting the correct scales.

    Settings.System.TRANSITION_ANIMATION_SCALE 
    

    Will change the Activity transitions.

    Where as:

    Settings.System.WINDOW_ANIMATION_SCALE
    

    Will effect the Window animations such as Dialogs opening.

    (Added API16) This will enable/disable View specific animations.

    Settings.System.ANIMATOR_DURATION_SCALE
    

    Also I'm pretty sure these are floats as these can be 0.5x animation settings meaning half speed. I have never tried these from an App before.

    But two things come to mind:

    • The ContentProvider is asynchronous, and you will need to listen to the Setting to finished being set
    • Also that these will probably not work until you create/finish and activity. meaning changing them mid activity might not effect the current Activity, but I will have to test that theory.
    0 讨论(0)
提交回复
热议问题