Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Understanding constraintBottom and constraintBaseline

Among all the ConstraintLayout attributes available in Android Studio 2.2, there are these two Bottom constrains and a Baseline constrain:

layout_constraintBottom_toTopOf
layout_constraintBottom_toBottomOf
layout_constraintBaseline_toBaselineOf

And it seems that not every view has baseline.

What's the difference and similarities between Bottom and Baseline constrain? Why do only certain views have a Baseline?

The official documentation lacks this kind of information.

EDIT
This image helps to understand baseline vs base: Baseline is the text's base inside a view. It is between the top and the bottom. Text and bottom-with-text baseline

like image 571
goetzc Avatar asked Sep 06 '25 08:09

goetzc


1 Answers

Baseline is used for make view bottom to bottom of text

for example in EditText the text is not the bottom so if you use baseline it will be in bottom of

EditText's text not EditText's view

enter image description here

more info from android developer training official website

like image 153
amorenew Avatar answered Sep 12 '25 16:09

amorenew