繁体   English   中英

如何摆脱汉堡图标导航抽屉旁边的多余空间

[英]How to get rid of extra space next to hamburger icon navigation drawer

在此处输入图片说明

我的布局如图所示,这就是我的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"
    android:fitsSystemWindows="true"
    app:contentInsetLeft="0dp"
    app:contentInsetStart="0dp"
    tools:context="pulsesecure.net.securewebbrowser.HomeActivity">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="0dp"
        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:background="?attr/colorPrimary"
            android:paddingTop="10dp"
            android:paddingBottom="5dp"
            app:popupTheme="@style/AppTheme.PopupOverlay">
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical">

                <LinearLayout
                    android:id="@+id/frag_toolbar"
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    android:layout_weight="9"
                    android:orientation="horizontal"
                    android:visibility="gone">
                    <TextView
                        android:id="@+id/frag_title"
                        android:layout_width="0dp"
                        android:layout_weight="9"
                        android:layout_height="match_parent"
                        android:textColor="@android:color/white"
                        android:gravity="center_vertical"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        />

                    <ImageButton
                        android:id="@+id/add_tab_btn"
                        android:layout_width="0dp"
                        android:layout_weight="1"
                        android:layout_height="match_parent"
                        android:src="@mipmap/ic_add_white_24dp"
                        android:background="@color/colorPrimaryDark"
                        />
                </LinearLayout>
                <LinearLayout
                    android:id="@+id/urlBar"
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    android:layout_weight="9"
                    android:orientation="horizontal"
                    android:visibility="gone"
                    android:background="@color/colorPrimaryDark"
                    android:focusableInTouchMode="true"
                    >
                    <EditText
                        android:id="@+id/searchET"
                        android:layout_width="0dp"
                        android:layout_weight="9"
                        android:layout_height="match_parent"
                        android:textColor="@android:color/darker_gray"
                        android:layout_gravity="center"
                        android:imeOptions="actionGo"
                        android:singleLine="true"
                        android:hint="@string/hint_url"
                        android:selectAllOnFocus="true"
                        android:background="@drawable/rounded_edit_text"
                       />


                    <ImageButton
                        android:id="@+id/delete_url"
                        android:layout_width="0dp"
                        android:layout_weight="1"
                        android:layout_height="match_parent"
                        android:layout_margin="5dp"
                        android:src="@mipmap/ic_clear_white_24dp"
                        android:background="@color/colorPrimaryDark"
                        />
                </LinearLayout>

                <LinearLayout
                    android:id="@+id/select_url_bar"
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    android:layout_weight="9"
                    android:orientation="horizontal"
                    android:visibility="gone"
                    android:background="@color/colorPrimaryDark"
                    android:focusableInTouchMode="true"
                    >

                    <TextView
                        android:id="@+id/url_text"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:layout_marginRight="5dp"
                        android:text="text view"
                        android:clickable="true"
                        android:singleLine="true"
                        android:gravity="center_vertical"
                        android:textColor="@android:color/black"
                        style="@style/PSFont"
                        android:background="@drawable/rounded_edit_text"/>


                </LinearLayout>

            </LinearLayout>

        </android.support.v7.widget.Toolbar>
        <ProgressBar
            android:id="@+id/page_load_progress"
            style="@android:style/Widget.ProgressBar.Horizontal"
            android:layout_width="match_parent"
            android:layout_height="3dp"
            android:progressTint="@color/colorAccent"
            android:visibility="invisible"
           />
    </android.support.design.widget.AppBarLayout>

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



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

我需要摆脱汉堡包图标和Edittext(以橙色箭头突出显示)之间的空间。 我尝试填充和插入,但到目前为止还没有运气。 有人可以给我指点吗? 谢谢。

我的坏人,我应该更加努力地寻找:我要做的就是:

app:contentInsetStartWithNavigation =“ 0dp”在我的工具栏布局中。

在Android工具栏中删除汉堡包(菜单)图标后的大填充?

尝试在<android.support.v7.widget.Toolbar>添加以下属性。

app:contentInsetStartWithNavigation="0dp"

添加它可以正常工作,如果仍然不起作用,那么只需添加这两个属性

app:contentInsetLeft="0dp"
app:contentInsetStart="0dp" 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM