Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use creators in ConstraintLayout

In the ConstraintLayout we have new type of param creator: layout_constraintTop_creator or layout_constraintRight_creator How it should be used?

like image 676
Vitaliy Ptitsin Avatar asked Sep 27 '16 08:09

Vitaliy Ptitsin


People also ask

What is the use of 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.

Can we use linear layout in ConstraintLayout?

You can create linear layouts now with ConstraintLayout by constraining the sides of each element with each other. The quick way of creating these layouts is to select all the views together and right click to center horizontally or vertically.

Can we use ConstraintLayout inside ConstraintLayout?

You can use a ConstraintLayout in an other ConstraintLayout but you need to respect some rules. All direct childs of a ConstraintLayout should have constraint on left,top, right and bottom.


1 Answers

As the namespace implies (tools:layout_constraintTop_creator), it's purely used by Android Studio -- those attributes (using the namespace tool) are actually stripped out when the xml file is pushed on a device.

So it shouldn't be used :)

Now if you want to know how Studio use those, it's actually simple: we use the creator attributes to keep track of who created the constraints, particularly if they are created by the inference engine, as we want to scrap them / replace them in some cases.

like image 109
Nicolas Roard Avatar answered Sep 20 '22 20:09

Nicolas Roard