当启动一个activity或者应用的时候,系统会先加载一个window preview的UI来增加过渡效果,但是有时候这种效果体验并不好,比如用户自定义的白色界面,然后预览的黑色界面,这样不和谐,如果需要去掉这种预览效果,需要做如下修改:
1.增加一个style?
<style name="Theme.NoDisplay" parent="@android:Theme"> <item name="android:windowBackground">@null</item> <item name="android:windowContentOverlay">@null</item> <item name="android:windowIsTranslucent">false</item> <item name="android:windowAnimationStyle">@null</item> <item name="android:windowDisablePreview">true</item> <item name="android:windowNoDisplay">false</item> </style>
?2.在activity里面调用
android:theme="@style/Theme.NoDisplay"
?
相关的系统说明如下 ,android.view.
android.view.WindowManagerPolicy里面定义,
com.android.internal.policy.impl.PhoneWindowManager里面实现:
?
/** * Called when the system would like to show a UI to indicate that an * application is starting. You can use this to add a * APPLICATION_STARTING_TYPE window with the given appToken to the window * manager (using the normal window manager APIs) that will be shown until * the application displays its own window. This is called without the * window manager locked so that you can call back into it. * * @param appToken Token of the application being started. * @param packageName The name of the application package being started. * @param theme Resource defining the application's overall visual theme. * @param nonLocalizedLabel The default title label of the application if * no data is found in the resource. * @param labelRes The resource ID the application would like to use as its name. * @param icon The resource ID the application would like to use as its icon. * @param windowFlags Window layout flags. * * @return Optionally you can return the View that was used to create the * window, for easy removal in removeStartingWindow. * * @see #removeStartingWindow */ public View addStartingWindow(IBinder appToken, String packageName, int theme, CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes, int icon, int windowFlags);
?
?
?
?
?
?
?
?
?