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