Khi tôi áp dụng các tính năng tự động tạo ra AppTheme.NoActionBar
để hoạt động của tôi qua android:theme
như vậy:Bar Status Android minh bạch khi sử dụng AppTheme.NoActionBar
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="mypackage">
<application
...
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:theme="@style/AppTheme.NoActionBar" />
</application>
</manifest>
MainActivity My là kết xuất với thanh trạng thái trong suốt ở trên cùng, cuối cùng có nền trắng và văn bản màu trắng trên đó. Nếu thiết bị đang sạc, đó là biểu tượng duy nhất được nhìn thấy.
Transparent ActionBar từ AppTheme.NoActionBar
Đây là giá trị của tôi/styles.xml:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar"/>
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light"/>
</resources>
Trong phong cách thứ hai, bạn có thể thấy AppTheme.NoActionBar
, mà theo mặc định kế thừa AppTheme, tuy nhiên không nơi nào trong cả hai kiểu chỉ định rằng thanh trạng thái phải trong suốt.