我正在使用继承自 "android:Theme.Material.Light"
的主题,但无法找到一种方法来隐藏 xml 样式自定义项中的操作栏。使用 "Theme.AppCompat.Light"
时,我可以用这样的方式来做
<style name="MyTheme" parent="Theme.AppCompat.Light">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
</style>
如何使用 Material 主题获得类似的结果?我知道你可以通过编程方式隐藏它,但这不仅不方便,因为你实际上无法在 Android Studio 上看到真正的布局,而不必每次都运行该应用程序,而且,当你运行应用程序,在 getActionBar().hide()
运行之前看起来真的很不专业。
解决方案:
<style name="MyTheme" parent="android:Theme.Material.Light">
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
</style>
最佳答案
<style name="MyTheme" parent="android:Theme.Material.Light.NoActionBar">
关于Android - 在 xml 中隐藏 Material 主题中的操作栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31750440/