2017-02-26 20 views
2

この記事では、Androidアプリケーション用のスプラッシュ画面を作成しようとしています:Splash Screens the Right Way記事では、背景ビットマップとロゴ(ビットマップ)の2つのレイヤーでLayerDrawableを作成しました。ロゴは、画面の一番下にインデント32dpで配置する必要があります。ここに私の描画可能:Android半透明のステータスバー、半透明のナビゲーションバー(存在する場合)

<item 
    android:drawable="@drawable/splash_image" /> 

<item 
    android:id="@+id/logo" 
    android:bottom="@dimen/margin_splash"> 

    <bitmap 
     android:gravity="bottom|center" 
     android:src="@drawable/logo_green" /> 
</item> 

私はスプラッシュ活動のテーマでandroid:windowBackgroundのparamとしてこの描画可能と指摘しました。私はまた、この機能がサポートされているデバイス(API> = 19)にスプラッシュ画面が表示されているときに透明なステータスバーを持っていたいので、別のアンドロイドバージョンとv19 \ styles.xmlの2つのリソースファイルを作成しました。android:windowTranslucentStatus真実として。ここに私のvalues/styles.xmlvalues-v19/styles.xml

値/のstyles.xml

<?xml version="1.0" encoding="utf-8"?> 
<resources> 
    <style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar"> 
     <item name="android:windowBackground">@drawable/bg_splash</item> 
    </style> 
</resources> 

<?xml version="1.0" encoding="utf-8"?> 
<resources> 
    <style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar"> 
     <item name="android:windowBackground">@drawable/bg_splash</item> 
     <item name="android:windowTranslucentStatus">true</item> 
    </style> 
</resources> 

しかし、ソフトNavigationBarといくつかのAndroidデバイス上の
値-V19 /のstyles.xml私のロゴはそれによって重なり合っています。
私はandroid:windowTranslucentNavigationフラグを偽としましたが、成功しなかったことを指摘しようとしました。

透明ステータスバーと一緒にAndroid Soft NavigationBarを透明にする方法はありますか、またはNavigationBarの高さにロゴの下に字下げを追加することでLayerBrawableのonCreateメソッドでSoft NavigationBarの可用性を検出する必要がありますか?

ありがとうございました。

答えて

0

これを試しましたか?

<item name="android:navigationBarColor">@android:color/transparent</item> <item name="android:windowTranslucentStatus">false</item> <item name="android:windowTranslucentNavigation">false</item> 

また、レイヤードローラーブルのビットマップアイテムに少し下の詰め物を追加することもできます。

0

同じ問題が発生し、次の属性を設定してこの問題を解決しました。

<item name="android:windowDrawsSystemBarBackgrounds">false</item> 

この属性はvalues-v21ディレクトリに設定されています。

関連する問題