android-layout - 了解constraintBottom 和constraintBaseline

标签 android-layout android-studio android-constraintlayout

在 Android Studio 2.2 中可用的所有 ConstraintLayout 属性中,有这两个底部约束和一个基线约束:
layout_constraintBottom_toTopOflayout_constraintBottom_toBottomOflayout_constraintBaseline_toBaselineOf
似乎并不是每个 View 都有基线。

底部和基线约束之间有什么区别和相似之处?为什么只有某些 View 有基线?

official documentation缺乏这种信息。

编辑
此图像有助于了解基线与基础:
Baseline is the text's base inside a view. It is between the top and the bottom.
Text and bottom-with-text baseline

最佳答案

基线用于使 View 从底部到底部的文本

例如在 EditText 中,文本不是底部所以
如果您使用基线,它将位于底部

EditText的正文 不是 EditText 的 查看

enter image description here

更多信息来自 android developer training official website

关于android-layout - 了解constraintBottom 和constraintBaseline,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39802390/

相关文章:

android-studio - android studio 中的 flutter 说找不到要转到的声明......我正在使用它的最新版本 v1.7.8+hotfix.4

android - Android Studio建议

android - 在 android ConstraintLayout 的响应式设计中有效地使用边距

java - ConstraintLayout 以编程方式设置constrainHeight_default

单个 Activity 上的 Android 多个 ListView 不显示项目

android - 使用按钮更改属性 use_flash true/false

android - 我想根据条件更改布局中的菜单可见性

android-studio - buildTypes 不能应用于 groovy.lang.Closure

android - 如何在 ConstraintLayout 中水平对齐两个 TextView 而不重叠?

Android:如何在 xml 中平衡 GridLayout