N Sharma
N Sharma

Reputation: 34497

How to remove space between navigation view button and toolbar text

Hi I am working on android app where I am using Navigation and ToolBar for my home activity.

I see that there is much space right side of NavigationView button and before ToolBar. Is there any way to remove it.

ToolBarLayout.xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:local="http://schemas.android.com/apk/res-auto"
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="100dp"
    android:background="@color/blue_background"
    android:minHeight="?attr/actionBarSize"
    app:contentInsetEnd="0dp"
    app:contentInsetStart="0dp"
    app:layout_collapseMode="pin"
    app:layout_scrollFlags="scroll|enterAlways"
    local:popupTheme="@style/ThemeOverlay.AppCompat.Light"
    local:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">


    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal">

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="left|center_horizontal"
            android:layout_marginTop="15dp"
            android:orientation="horizontal"


            >

            <ImageView
                android:id="@+id/back_arrow"
                android:layout_width="25dp"
                android:layout_height="25dp"
                android:layout_gravity="center"
                android:layout_marginLeft="8dp"
                android:layout_marginRight="8dp"
                android:src="@drawable/back_arrow" />

            <TextView
                android:id="@+id/title_text"
                android:layout_width="wrap_content"
                android:layout_height="fill_parent"
                android:layout_gravity="center"
                android:gravity="center"
                android:text="XYZ"
                android:textColor="@color/white"
                android:textSize="19sp" />

        </LinearLayout>

        <LinearLayout
            android:id="@+id/wallet_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginTop="20dp"
            android:gravity="right"
            android:orientation="horizontal">

            <LinearLayout
                android:id="@+id/wallet_click_view"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal">


                <ImageView
                    android:id="@+id/wallet_icon"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/wallet" />

                <FrameLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="5dp"
                    android:layout_marginRight="5dp">

                    <in.xxx.utils.RobotoMediumTextView
                        android:id="@+id/walet_balance"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:textColor="@color/white"
                        android:textSize="14sp" />

                    <ProgressBar
                        android:id="@+id/progressBar"
                        style="?android:attr/android:progressBarStyleSmall"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:progressDrawable="@drawable/progressbar_color"
                        android:visibility="gone" />


                </FrameLayout>
            </LinearLayout>


            <ImageView
                android:id="@+id/notification"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="5dp"
                android:layout_marginRight="10dp"
                android:src="@drawable/notification"
                android:visibility="gone" />


        </LinearLayout>


        <FrameLayout
            android:id="@+id/notificationLayout"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="top|right"
            android:layout_marginRight="-3dp"
            android:layout_marginTop="2dp"
            android:visibility="gone"></FrameLayout>
    </FrameLayout>


</android.support.v7.widget.Toolbar>

Please check this screenshot.

enter image description here

enter image description here

Upvotes: 2

Views: 324

Answers (1)

Ajay S
Ajay S

Reputation: 48602

You can solve this by adding this in toolbar.

app:contentInsetStartWithNavigation="0dp"

Upvotes: 1

Related Questions