Features of ConstrainLayout in Android

There are various features associated with ConstraintLayout in Android mentioned below:

  1. Constrains in Android
  2. Ratio in Android
  3. Chains in Android

Note : To access the full android application using ConstraintLayout check this repository: ConstraintLayout in Android Application

ConstraintLayout in Android

ConstraintLayout is similar to that of other View Groups which we have seen in Android such as RelativeLayout, LinearLayout, and many more. In this article, we will take a look at using ConstraintLayout in Android. 

Important Attributes of ConstraintLayout 

Attributes

Description

android:id This is used to give a unique ID to the layout. 
app:layout_constraintBottom_toBottomOfThis is used to constrain the view with respect to the bottom position.
app:layout_constraintLeft_toLeftOfThis attribute is used to constrain the view with respect to the left position.
app:layout_constraintRight_toRightOfThis attribute is used to constrain the view with respect to the right position. 
app:layout_constraintTop_toTopOfThis attribute is used to constrain the view with respect to the top position.

app:layout_constraintHeight_max

This attribute is used to set the max height of view according to the constraints.

app:layout_constraintHeight_min

This attribute is used to set the height of the view according to the constraints.

app:layout_constraintHorizontal_weight

This attribute is used to set the weight horizontally of a particular view same as linear layouts.

app:layout_constraintVertical_weight

This attribute is used to set the weight vertically of a particular view same as linear layouts.

Similar Reads

Step by Step Implementation for adding Constraint Layout in Android

Step 1: Create a New Project...

Features of ConstrainLayout in Android

There are various features associated with ConstraintLayout in Android mentioned below:...

Click Here to Learn How to Create Android Application

...

Contact Us