The problem that I find when I used toolbar was the default left margin of the toolbar.
Basically its left inset, and it is caused by Toolbar's contentInsetStart.
left inset of the Toolbar is by default 16dp so we see such margin on the left.
So For API<=21
We need to use this
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
For API>=21
android:contentInsetLeft="0dp"
android:contentInsetStart="0dp"
Below is the code:
<?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"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="@android:color/white"
android:contentInsetEnd="0dp"
android:contentInsetRight="0dp"
android:contentInsetStart="0dp"
app:contentInsetEnd="0dp"
app:contentInsetLeft="0dp"
app:contentInsetRight="0dp"
app:contentInsetStart="0dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/back_button_challenge_details"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:src="@mipmap/back_btn" />
<ImageView
android:id="@+id/profile_picture_home"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_alignParentLeft="true"
android:layout_margin="5dp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@mipmap/flexfit_header_logo" />
<ImageView
android:id="@+id/drawer_open_challenge_details"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_margin="12dp"
android:background="@mipmap/menu_icon" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_alignParentBottom="true"
android:background="@android:color/darker_gray"
/>
</RelativeLayout>
</android.support.v7.widget.Toolbar>
0 Comment(s)