NavigationView Takes Too Much Space Toolbar

1

Currently estimated I use NavigationView

<android.support.design.widget.NavigationView
        android:id="@+id/nav_view"
        android:layout_width="330dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:fitsSystemWindows="true"
        app:headerLayout="@layout/nav_header_main"
        app:menu="@menu/activity_main_drawer"
        android:background="@color/white"
        app:itemIconTint="#000000" />

in all my views I implement my toolbar

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

Code

<?xml version="1.0" encoding="utf-8"?>

             

        xmlns:android="http://schemas.android.com/apk/res/android">
            <TextView
                android:id="@+id/title"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="left"
                android:layout_marginTop="8dp"
                android:layout_marginRight="80dp"
                android:textSize="15dp"
                android:layout_centerHorizontal="true"
                android:textColor="@color/black"/>
            <TextView
                android:id="@+id/subTitle"
                android:layout_centerHorizontal="true"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginRight="80dp"
                android:gravity="left"
                android:layout_below="@id/title"
                android:textSize="12dp"
                android:textColor="@color/black"/>
        <ImageView
            android:id="@+id/ImagensiguienteToolbar"
            android:layout_marginTop="10dp"
            android:layout_width="30dp"
            android:layout_marginRight="15dp"
            android:layout_height="30dp"
            android:layout_alignParentRight="true"
            android:onClick="goToAdd"
            android:layout_weight="1"/>
        <ImageView
            android:id="@+id/ImagenatrasToolbar"
            android:layout_marginTop="10dp"
            android:layout_width="30dp"
            android:layout_alignParentLeft="true"
            android:layout_height="30dp"
            android:onClick="goToBack" />
    </RelativeLayout>
</android.support.v7.widget.Toolbar>

the issue is that when I put an arrow on the left side it looks like this

and the truth that this blank space is as taken by the NavigationView, since from the view of the toolbar it does not let me place it more to the left here photo

Even if the viewer shows me the limit, when you see it on a phone it looks like the first image very far to the right, any help will be welcome

What I can not find is where this size is located

    
asked by Bruno Sosa Fast Tag 03.11.2017 в 18:24
source

1 answer

1

As an option you can add style to your Toolbar with the property contentInsetStartWithNavigation setting a value of 0 dp:

<item name="contentInsetStartWithNavigation">0dp</item>

or you can programmatically define the same property:

myToolbar.setContentInsetStartWithNavigation(0);

to eliminate the space between the arrow and the navigation button, since by default it has a defined value.

    
answered by 03.11.2017 / 19:24
source