如何删除切换图标和搜索图标之间的多余空间?

时间:2019-05-06 06:06:34

标签: android android-toolbar

我想在工具栏的抽屉切换图标旁边显示搜索图标。但是它们之间有很大的空间。如何删除空间

下面是我工具栏的当前情况。我想删除切换图标和搜索图标之间的多余空间。我该怎么做

Imgur

app_bar_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"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".ui.activity.MainActivity">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/AppTheme.AppBarOverlay">
        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:layout_margin="@dimen/toolbarMargin"
            android:background="@android:color/white"
            app:popupTheme="@style/AppTheme.PopupOverlay">
            <include layout="@layout/search_actionbar"/>
        </android.support.v7.widget.Toolbar>

    </android.support.design.widget.AppBarLayout>

    <include layout="@layout/content_main" />


</android.support.design.widget.CoordinatorLayout>

search_actionbar.xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/custom_view"
    android:layout_width="match_parent"
    android:layout_height="?actionBarSize"
    android:clipChildren="false">

    <ImageView
        android:id="@+id/search_icon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="left|center"
        android:scaleType="center"
        android:src="@drawable/ic_search"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="8dp"
        android:text="Search here..."
        android:textColor="@android:color/black"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintStart_toEndOf="@+id/search_icon"
        app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>

0 个答案:

没有答案