ฉันกำลังพยายามสร้างหน้าจอสแปลชสำหรับแอปพลิเคชัน Android ด้วยบทความนี้: หน้าจอสแปลชอย่างถูกวิธี ดังที่บทความกล่าวไว้ ฉันสร้าง LayerDrawable ด้วยสองชั้น: บิตแมปพื้นหลังและโลโก้ (รวมถึงบิตแมปด้วย) โลโก้จะต้องอยู่ที่ด้านล่างของหน้าจอโดยมีการเยื้อง 32dp เป็นต้น ที่นี่สิ่งที่วาดได้ของฉัน:
<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>
I pointed this drawable as android:windowBackground
param in my splash activity theme. I also want to have transparent status bar when splash screen is shown on devices where this feature is supported (API >=19), so I created two resource files for different android versions and in values-v19\styles.xml I pointed flag android:windowTranslucentStatus
as true. Here my values/styles.xml
and values-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>
และ
values-v19/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>
<item name="android:windowTranslucentStatus">true</item>
</style>
</resources>
แต่ในอุปกรณ์ Android บางรุ่นที่มี Soft NavigationBar โลโก้ของฉันซ้อนทับกัน
ฉันพยายามชี้ธง android:windowTranslucentNavigation
เป็นเท็จแต่ก็ไม่สำเร็จ
มีวิธีใดที่จะทำให้ Android Soft NavigationBar โปร่งใสพร้อมกับแถบสถานะโปร่งใสหรือฉันต้องตรวจสอบความพร้อมใช้งานของ Soft NavigationBar ในวิธีการ onCreate ของกิจกรรมสแปลชของฉันและอัปเดต LayerDrawable ของฉันโดยเพิ่มการเยื้องด้านล่างสำหรับโลโก้ที่ความสูงของ NavigationBar
ขอบคุณ.