• theme-windowAnimationStyle 动画设置


    对于windowAnimationStyle 的引用,目前自己发现的有两处

    1.就是直接在Theme 中引用的,如下

    <style name="Theme.Funui" parent="Theme.Holo.Light">
      <!--activity 动画引用-->
      <item name="android:windowAnimationStyle">@android:style/Animation.Holo.Activity</item>
    </style> <style name="Animation.Holo.Activity" parent="Animation.Activity">
    </style>
    <style name="Animation.Activity">
           <!--A打开B,B的出现动画-->
    <item name="activityOpenEnterAnimation">@anim/activity_open_enter</item>
            <!--A打开B,A的消失动画-->
    <item name="activityOpenExitAnimation">@anim/activity_open_exit</item>
             <!--A关闭B,B的出现动画-->
    <item name="activityCloseEnterAnimation">@anim/activity_close_enter</item>

             <!--A关闭B,A的消失动画-->
             <item name="activityCloseExitAnimation">@anim/activity_close_exit</item> 
             <item name="taskOpenEnterAnimation">@anim/task_open_enter</item>
             <item name="taskOpenExitAnimation">@anim/task_open_exit</item>
             <item name="taskCloseEnterAnimation">@anim/task_close_enter</item>
             <item name="taskCloseExitAnimation">@anim/task_close_exit</item>
             <item name="taskToFrontEnterAnimation">@anim/task_open_enter</item>
             <item name="taskToFrontExitAnimation">@anim/task_open_exit</item>
             <item name="taskToBackEnterAnimation">@anim/task_close_enter</item>
             <item name="taskToBackExitAnimation">@anim/task_close_exit</item>
             <item name="wallpaperOpenEnterAnimation">@anim/wallpaper_open_enter</item>
             <item name="wallpaperOpenExitAnimation">@anim/wallpaper_open_exit</item>
             <item name="wallpaperCloseEnterAnimation">@anim/wallpaper_close_enter</item>
             <item name="wallpaperCloseExitAnimation">@anim/wallpaper_close_exit</item>
             <item name="wallpaperIntraOpenEnterAnimation">@anim/wallpaper_intra_open_enter</item>
             <item name="wallpaperIntraOpenExitAnimation">@anim/wallpaper_intra_open_exit</item>
             <item name="wallpaperIntraCloseEnterAnimation">@anim/wallpaper_intra_close_enter</item>
             <item name="wallpaperIntraCloseExitAnimation">@anim/wallpaper_intra_close_exit</item>
             <item name="fragmentOpenEnterAnimation">@animator/fragment_open_enter</item>
             <item name="fragmentOpenExitAnimation">@animator/fragment_open_exit</item>
             <item name="fragmentCloseEnterAnimation">@animator/fragment_close_enter</item>
             <item name="fragmentCloseExitAnimation">@animator/fragment_close_exit</item>
             <item name="fragmentFadeEnterAnimation">@animator/fragment_fade_enter</item>
             <item name="fragmentFadeExitAnimation">@animator/fragment_fade_exit</item>
     </style>

    还有一种引用,是在Theme.Dialog中

    如下

    <style name="Theme.Funui" parent="Theme.Holo.Light">
    
    <item name="dialogTheme">@android:style/Theme.Funui.Dialog</item>
    
    </style>
    
     <style name="Theme.Funui.Dialog" >
            <item name="android:windowFrame">@null</item>
            <item name="android:windowTitleStyle">@android:style/DialogWindowTitle.Funui</item>
            <item name="android:windowBackground">@android:drawable/dialog_full_funui</item>
            <item name="android:windowIsFloating">true</item>
            <item name="android:windowContentOverlay">@null</item>
            <item name="android:windowAnimationStyle">@android:style/Animation.Funui.Dialog</item>
            <item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
            <item name="android:windowActionBar">false</item>
            <item name="android:windowActionModeOverlay">true</item>
            <item name="android:windowCloseOnTouchOutside">@bool/config_closeDialogWhenTouchOutside</item>
    
            <item name="android:colorBackgroundCacheHint">@null</item>
    
            <item name="android:buttonBarStyle">@android:style/Funui.ButtonBar.AlertDialog</item>
            <item name="borderlessButtonStyle">@android:style/Widget.Funui.Button.Borderless.Small</item>
    
            <item name="textAppearance">@android:style/TextAppearance.Funui</item>
            <item name="textAppearanceInverse">@android:style/TextAppearance.Funui.Inverse</item>
    
            <item name="listPreferredItemPaddingLeft">16dip</item>
            <item name="listPreferredItemPaddingRight">16dip</item>
            <item name="listPreferredItemPaddingStart">16dip</item>
            <item name="listPreferredItemPaddingEnd">16dip</item>
    
            <item name="preferencePanelStyle">@style/PreferencePanel.Dialog</item>
        </style>      
        <style name="Animation.Funui.Dialog" parent="Animation.Dialog">
    <item name="windowEnterAnimation">@anim/funui_dialog_enter</item> <item name="windowExitAnimation">@anim/funui_dialog_exit</item> </style>

    funui_dialog_enter 跟funui_dialog_exit 两个文件内容如下

    <!--enter-->
    <?xml version="1.0" encoding="utf-8"?>
    <set xmlns:android="http://schemas.android.com/apk/res/android"
        android:duration="400"
        android:fillAfter="true"
        android:fillBefore="true"
        android:fillEnabled="true"
        android:interpolator="@anim/decelerate_interpolator" >
    
        <translate
            android:fromXDelta="0.0%"
            android:fromYDelta="100.0%"
            android:toXDelta="0.0%"
            android:toYDelta="0.0%" />
    
    </set>
    
    <!--exit-->
    <?xml version="1.0" encoding="utf-8"?>
    <set xmlns:android="http://schemas.android.com/apk/res/android"
        android:duration="400"
        android:fillAfter="true"
        android:fillBefore="true"
        android:fillEnabled="true"
        android:interpolator="@anim/decelerate_interpolator" >
    
        <translate
            android:fromXDelta="0.0%"
            android:fromYDelta="0.0%"
            android:toXDelta="0.0%"
            android:toYDelta="100.0%" />
    
    </set>

    从上面两个代码我们就很容易理解了,虽然在不同的theme下,windowAnimationStyle 的引用一样,但是他们的属性是有区别的。一个是作用于activity,一个是作用在dialog中。

  • 相关阅读:
    C语言的指针
    C语言的编译过程和GCC编译参数
    GCC编译器的安装
    全字段多条件搜索(api接口)
    C# Replace字符替换函数
    NetCore MemoryCache使用
    vs2017 C# ActiveX浏览器插件 创建 发布 C# windows窗体控件库(.NET Framework)注意事项
    [Asp.net core 3.1] 通过一个小组件熟悉Blazor服务端组件开发
    [AspNetCore 3.0 ] Blazor 服务端组件 Render, RenderFragment ,RenderTreeBuilder, CascadingValue/CascadingParameter 等等
    [AspNetCore 3.0] 在RazorPages/MVC 中使用 Blazor (Razor组件)
  • 原文地址:https://www.cnblogs.com/zhangshuli-1989/p/zhangshuli_anim_150317131.html
Copyright © 2020-2023  润新知