Android 启动页图片与虚拟按键重叠

2019-02-19  本文已影响0人  _发强

通常情况下,我们为了避免 App 启动时的白屏问题,我们会给启动页添加一个 Theme .
可能如下:

    <style name="launcher_theme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="android:windowBackground">@drawable/launcher</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowFullscreen">true</item>
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
    </style>

这个确实避免了白屏的问题。但是,在有虚拟按键的时候,这个图片会往下偏移一些,到显示 LauncherActivity 页面时,会出现图片跳动一下的情况。没有虚拟按键的,就不会有这种问题。 这个问题还是 theme 的问题 。调整如下:

    <style name="launcher_theme" parent="android:Theme.NoTitleBar.Fullscreen">
        <item name="android:windowBackground">@drawable/launcher</item>
        <item name="windowActionBar">true</item>
    </style>

上一篇 下一篇

猜你喜欢

热点阅读