Google登录对话框关闭android studio后屏幕闪烁 [英] Screen flickers after Google Sign In dialog dismiss android studio
问题描述
我正在面对此问题,无法找到解决方案。我已使用Firebase在我的应用程序中实现了Google登录。我面临的问题是,每当登录对话框关闭时,黑条就会从上到下贯穿屏幕。它移动非常快,但仍然引人注目。我想删除在屏幕上延伸的黑条,以便用户平稳返回屏幕。
I'm facing this issue and am not able to find a solution to it. I have Google Sign In implemented in my app using firebase. The problem I'm facing is that whenever the Sign In dialog dismisses a black strip runs across the screen from top to bottom. It moves very fast but still is noticeable. I want to remove this black strip that runs across the screen so the user smoothly returns to the screen.
我尝试添加
overridePendingTransition(0, 0);
在onPause()和onResume()方法中,但仍然没有成功。
in onPause() and onResume() methods but still found no success.
有人可以帮助我找到解决这个问题的方法和/或如何实现吗?
Could anybody please help me to find a way around this and/or how could I achieve it?
推荐答案
我遇到了同样的问题,这困扰了我,但看起来并不好。
I had the same problem and it bothered me, it didn't look good.
我找到了解决方案!您可以在 styles.xml
中定义活动打开和关闭动画,然后使用 android:windowAnimationStyle 将它们分配给启动Google登录的活动。 code>。这是一个使用淡入淡出动画的示例:
I found a solution! You can define activity open and close animations in styles.xml
and assign them to the activity which starts the google sign in by using android:windowAnimationStyle
. Here is an example using fade animations:
styles.xml
:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowAnimationStyle">@style/ActivityAnimations</item>
</style>
<style name="ActivityAnimations" parent="@android:style/Animation.Activity">
<item name="android:activityOpenEnterAnimation">@anim/fade_in</item>
<item name="android:activityOpenExitAnimation">@anim/fade_out</item>
<item name="android:activityCloseEnterAnimation">@anim/fade_in</item>
<item name="android:activityCloseExitAnimation">@anim/fade_out</item>
</style>
AppTheme
样式已分配给应用程序或使用 android:theme = @ style / AppTheme $ c $在
AndroidManifest.xml
中启动Google登录流程的活动c>。
The style AppTheme
is assigned to the application or the activity that launches the google sign in flow in the AndroidManifest.xml
using android:theme="@style/AppTheme"
.
淡入:
<?xml version="1.0" encoding="utf-8"?>
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator"
android:fromAlpha="0.0" android:toAlpha="1.0"
android:duration="500"
/>
淡出:
<?xml version="1.0" encoding="utf-8"?>
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator"
android:fromAlpha="1.0" android:toAlpha="0.0"
android:fillAfter="true"
android:duration="500"
/>
这篇关于Google登录对话框关闭android studio后屏幕闪烁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!