Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing constraint warning for Barrier - Bug?

I get the missing constraints warning on the Barrier, which has been added to the (now stable) version 1.1.0 of the ConstraintLayout.

This view is not constrained, it only has designtime positions, so it will jump to (0,0) unless you add constraints

However, a Barrier to my knowledge doesn't use any constraints and I don't think it's even possible to add them

Is this a bug or am I missing something?

like image 490
Florian Walther Avatar asked Apr 20 '18 19:04

Florian Walther


People also ask

How do you fix missing constraints in constraint layout?

To automatically apply any missing constraints you can press the 'Infer Constraints' button at the top of the editor. The red warning sign should now have turned yellow because we have resolved the missing constraints error. Also, the TextView object should have blue arrows coming out of it when selected in the editor.

What is ConstraintLayout?

A ConstraintLayout is a ViewGroup which allows you to position and size widgets in a flexible way. Note: ConstraintLayout is available as a support library that you can use on Android systems starting with API level 9 (Gingerbread). As such, we are planning on enriching its API and capabilities over time.


2 Answers

If you have something like tools:layout_editor_absoluteX="123dp" or tools:layout_editor_absoluteY="384dp" defined on the barrier just remove it and the warning will go away.

like image 86
jesobremonte Avatar answered Nov 15 '22 08:11

jesobremonte


Are you Getting this type of error

enter image description here

Try adding barrier in this way

<android.support.constraint.Barrier
    android:id="@+id/barrier"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:constraint_referenced_ids="view1,view2" />
like image 37
Jamil Avatar answered Nov 15 '22 09:11

Jamil