简体   繁体   中英

Why action bar appears in AVD but not in Physical device?

I am building a bus ticket booking app. The action bar on top appears in my AVD, but it doesn't appear in my physical device. AVD 中的登录页面

物理设备中的登录页面

The themes.xml file

 <resources xmlns:tools="http://schemas.android.com/tools">
    <!-- Base application theme. -->
    <style name="Theme.BusTicketBooking" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
        <!-- Primary brand color. -->
        <item name="colorPrimary">#FF9800</item>
        <item name="colorPrimaryVariant">@color/purple_700</item>
        <item name="colorOnPrimary">@color/white</item>
        <!-- Secondary brand color. -->
        <item name="colorSecondary">@color/teal_200</item>
        <item name="colorSecondaryVariant">@color/teal_700</item>
        <item name="colorOnSecondary">@color/black</item>
        <!-- Status bar color. -->
        <item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
        <!-- Customize your theme here. -->
    </style>

    <style name="Theme.BusTicketBooking.NoActionBar">
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
    </style>

    <style name="Theme.BusTicketBooking.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

    <style name="Theme.BusTicketBooking.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
</resources>

Assuming you did not use your.NoActionBar theme style and does not have line of code that may interact with your action bar, have you tried checking if you have dark mode enabled in your physical phone? it might darken your current action bar color

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM