1
style.xml无法在主要活动显示操作栏
在这里,我故意禁止行动起来吧,因为我不希望它出现我的启动画面上
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
MainActivity.java
后我想通过使用set supportactionbar在主要活动中存在操作栏,但在运行代码后操作栏不起作用,并且整个过程没有错误,有人能告诉我我的代码出了什么问题。
Toolbar tb;
tb = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(tb);