Strange Android Binding Behavior

Version of my restriction template 1.0.0-alpha8. After I included the toolbar in my layout, there is a place in the left and right parts of the toolbar, for example, the image below

enter image description here

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>

What I included in my layout as follows

<include
    layout="@layout/toolbar_top"
    android:id="@+id/topPanel"
    android:layout_height="wrap_content"
    android:layout_width="match_parent"/>

I did not use any additional extras or fields in the root element of the layout file.

One more thing: if I compile or create a program, my code will be automatically changed, for example

<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 manual also adds some additional value that I did not write, for example layout_editor_absoluteXautomatically 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"/>
+4
source share
1

-, - ConstraintLayout 4.

: match_parent - ConstraintLayout. :

app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"

0dp match_parent:

<include
    layout="@layout/toolbar_top"
    android:id="@+id/topPanel"
    android:layout_height="wrap_content"
    android:layout_width="0dp"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"/>

, , image

Android Studio 2.2 , Android Studio 2.3 .

+13

Source: https://habr.com/ru/post/1660943/


All Articles