如何使用Invisible Action Bar而不是Back按钮我需要在Android Activity中使用后退按钮而不是操作栏

时间:2018-05-28 17:21:49

标签: android android-actionbar styles back-button

我尝试了不同的隐形动作条,但我的后退按钮也变得不可见,我不想要,请告诉我该怎么做。 这是我的照片,我想回到左上角的This is my pic where I wanna back button on left upper corner

按钮

这是我的样式代码:

 <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>

这是我的java代码:

 ActionBar actionBar = getSupportActionBar();
       //actionBar.setDisplayShowTitleEnabled(false);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setHomeButtonEnabled(true);
       actionBar.hide();

0 个答案:

没有答案