android - 如何删除 android 操作栏上的主页(和向上)按钮和标题之间的空格?

标签 android android-actionbar

在我的应用中,我不想在图标和操作栏标题之间​​留出额外的空间。 创建导航 Activity 时,菜单按钮是默认按钮。和我带来的后退箭头

 <activity
            android:name=".ShipmentList"
            android:label="Shimpment"
            android:parentActivityName=".MainNavigationActivity">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.mobile.MainNavigationActivity" />
        </activity>

在 AndroidManifest 中。

enter image description here

enter image description here

最佳答案

您必须在工具栏中使用这些行。

app:contentInsetEnd="0dp"
app:contentInsetLeft="0dp"
app:contentInsetRight="0dp"
app:contentInsetStart="0dp"
app:contentInsetStartWithNavigation="0dp"

像这样:

<android.support.v7.widget.Toolbar 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="?actionBarSize"
    android:background="@color/color18"
    android:elevation="0dp"
    android:theme="@style/ThemeOverlay.AppCompat.Dark"
    app:contentInsetEnd="0dp"
    app:contentInsetLeft="0dp"
    app:contentInsetRight="0dp"
    app:contentInsetStart="0dp"
    app:contentInsetStartWithNavigation="0dp" />

关于android - 如何删除 android 操作栏上的主页(和向上)按钮和标题之间的空格?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38185344/

相关文章:

android - menuitem 上的 actionlayout 什么都不做

android - 如何清除 ActionMode 上的 CloseButton

android - AppCompat 的全屏主题

android - 如何获取加密方案 UUID

android - 如何找出 ListView 是否已滚动到最顶部位置?

android - 以用户定义的频率同步选定的帐户

java - 在 android 嵌套的 PreferenceScreen 上显示向上/后退按钮?

Android 状态栏背景颜色设置为 R.attr.colorPrimary 但使用了错误的颜色

java - 方法声明无效 - 需要返回类型

android - 在应用程序开发期间软砖化 android 设备