[英]How to remove this arrow in the Toolbar on mainActivity Layout?
Some weeks ago, I added this Toolbar
. 几周前,我添加了此
Toolbar
。 I need it for a swipe tab layout. 我需要它来滑动选项卡布局。 But if I install the apk, there is a back arrow in the top left corner.
但是,如果我安装了apk,则左上角会有一个后退箭头。
I don't know how I can remove it. 我不知道如何删除它。 Can you help me?
你能帮助我吗?
If you need any other layouts or classes, please ask me. 如果您需要任何其他布局或类,请询问我。 I will edit the question.
我将编辑问题。
activity_main.xml
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabMode="fixed"
app:tabGravity="fill"/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
And here the 在这里
styles.xml
styles.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MyTheme" parent="MyTheme.Base">
</style>
<style name="MyTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>
Given the arrow's presence, I'm assuming you set your Toolbar
as the ActionBar
. 给定箭头的存在,我假设您将
Toolbar
设置为ActionBar
。
If so, the fix is very simple. 如果是这样,修复非常简单。 Simply call
只需致电
getActionBar().setDisplayHomeAsUpEnabled(false);
AFTER you have called setActionBar(yourToolbar)
to ensure there are no null pointer issues 调用
setActionBar(yourToolbar)
,确保没有空指针问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.