简体   繁体   中英

Why does Theme.AppCompat.NoActionBar not hide the action bar while android:Theme.Material.NoActionBar does

I recently tried learning Android development, however I am struggling to understand why a basic function does not seem to work.

When setting the parent of AppTheme to Theme.AppCompat.NoActionBar , the title bar is not hidden like it is supposed to. Even manually adding

<item name="windowActionBar">false</item> <item name="windowNoTitle">true</item>

to my AppTheme does not fix it. Curiously, setting the parent of AppTheme to android:Theme.Material.NoActionBar does work.

Why is this?

Okay, I kinda solved it myself. While I have no idea why things are this way (the *.NoActionBar themes not working and anything but AppCompat themes causing crashes), I did manage to hide the ActionBar.

res/layout/activity_main.xml has a section defining the ActionBar too, so just the android:visibility="gone" property to <android.support.v7.widget.Toolbar made it work.

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