用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/DevonStee/OpenFlip --skill android-rotation-anti-flicker命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
基于 SOC 职业分类
| name | Android Rotation Anti-Flicker |
| description | Eliminate black flash and visual glitches during screen rotation in Android apps |
| last_verified | 2026-01-23T00:00:00.000Z |
| applicable_sdk | Android 8+ (API 26+) |
Last Verified: 2026-01-23 Applicable SDK: Android 8+ (API 26+), tested through Android 15 (API 35) Project Context: OpenFlip (Target SDK 35, Min SDK 26)
This skill provides a proven protocol to eliminate black screen flashes and visual glitches during screen rotation in Android applications.
Required Skills:
Related Skills:
New Behaviors:
Compatibility: All techniques in this skill remain valid for Android 15.
Add configChanges to prevent Activity recreation:
<activity
android:name=".MainActivity"
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden"
android:screenOrientation="fullSensor" />
Why: Prevents Activity destruction/recreation cycle that causes black screen.
values/themes.xml)<style name="AppTheme" parent="Theme.Material3.Light.NoActionBar">
<item name="android:windowBackground">@color/white</item>
</style>
values-night/themes.xml)<style name="AppTheme" parent="Theme.Material3.Dark.NoActionBar">
<item name="android:windowBackground">@color/black</item>
</style>
[!CAUTION] NEVER use
?attr/colorSurfaceor any dynamic attribute forwindowBackground. Dynamic attributes are resolved during rotation, causing a brief flash.
Apply to animation-heavy custom views:
class MyCustomView(context: Context, attrs: AttributeSet?) : View(context, attrs) {
init {
setLayerType(LAYER_TYPE_HARDWARE, null)
}
}
Why: Prevents GPU resource deallocation after idle periods. Without this, rotating after 10+ seconds of inactivity causes black flash as GPU re-rasterizes.
Override onConfigurationChanged instead of relying on Activity recreation:
override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)
// Recalculate dimensions, refresh layouts
myCustomView.requestLayout()
}
| Symptom | Cause | Fix |
|---|---|---|
| Black flash on first rotation | Missing windowBackground | Add hardcoded color in themes.xml |
| Flash after idle | GPU layer reclaimed | Add LAYER_TYPE_HARDWARE |
| Delayed rotation response | Activity recreating | Add configChanges in manifest |