The version of my constraint layout is 1.0.0-alpha8
. After I have included a toolbar in my layout , there is space in both left and right side of the toolbar, like the image below
Here is the code for my toolbar
<?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="?attr/actionBarSize"
android:background="@color/colorPrimary">
</android.support.v7.widget.Toolbar>
Which I have included in my layout in following way
<include
layout="@layout/toolbar_top"
android:id="@+id/topPanel"
android:layout_height="wrap_content"
android:layout_width="match_parent"/>
I didn't used any additional padding or margin in my root element of the layout file .
Another stange thing is if I compile or build the program my code automatically changed, like
<include
layout="@layout/toolbar_top"
android:id="@+id/topPanel"
android:layout_height="wrap_content"
android:layout_width="match_parent"/>
Change to
<include
layout="@layout/toolbar_top"
android:id="@+id/topPanel"
android:layout_height="wrap_content"
android:layout_width="368dp"/>
And the guideline also add some additional value which I didn't write, like layout_editor_absoluteX
automatically added .
<android.support.constraint.Guideline
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/guideline1"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.15"
tools:layout_editor_absoluteX="58dp"/>