Features of ConstrainLayout in Android
There are various features associated with ConstraintLayout in Android mentioned below:
- Constrains in Android
- Ratio in Android
- 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_toBottomOf | This is used to constrain the view with respect to the bottom position. |
app:layout_constraintLeft_toLeftOf | This attribute is used to constrain the view with respect to the left position. |
app:layout_constraintRight_toRightOf | This attribute is used to constrain the view with respect to the right position. |
app:layout_constraintTop_toTopOf | This 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. |
Contact Us