Skip to content

Instantly share code, notes, and snippets.

@beilly
Created September 23, 2019 06:37
Show Gist options
  • Save beilly/72296551eda7bd2702c2e54b23205d5c to your computer and use it in GitHub Desktop.
Save beilly/72296551eda7bd2702c2e54b23205d5c to your computer and use it in GitHub Desktop.
Android 两个界面间快速切换时,会发现有短暂黑屏
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="@integer/slide_animation_duration"
android:fromXDelta="-100%p"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:toXDelta="0"/>
</set>
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="@integer/slide_animation_duration"
android:fromXDelta="-100%p"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:toXDelta="100%p"/>
</set>
@beilly
Copy link
Author

beilly commented Sep 23, 2019

实际是动画使用错误,应该是android:toXDelta="0"

https://www.cnblogs.com/lipeil/p/3424902.html
<item name="android:windowIsTranslucent">true</item>
这种解决方案会导致 onStart回调异常

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment