- Mastering Android Studio 3
- Kyle Mew
- 123字
- 2021-07-02 18:42:36
Baseline alignment
Aligning text across multiple views using their baselines can be fiddly, especially when text is of different sizes. Fortunately, constraint layouts offer a simple and easy way to achieve this.
Any constrained view or widget designed to contain text, will contain a bar across its center. Hover over this for a moment, until it flashes, and then drag it to the view whose text you wish to align it with, as seen here:

Baseline alignment.
You will probably be familiar with the gravity attributes that the relative layout class uses to control positioning.
Baseline constraints can only be connected to other baselines.
The constraint layout introduces a new approach, allowing us to control the relative distances either side of the view.
推薦閱讀
- 數據庫系統原理及MySQL應用教程(第2版)
- Oracle Exadata性能優化
- PyTorch自動駕駛視覺感知算法實戰
- Practical Data Science Cookbook(Second Edition)
- C#程序設計教程
- INSTANT Django 1.5 Application Development Starter
- C#實踐教程(第2版)
- JavaCAPS基礎、應用與案例
- Create React App 2 Quick Start Guide
- 21天學通C++(第5版)
- Regression Analysis with Python
- R Data Science Essentials
- Python機器學習與量化投資
- SQL Server實例教程(2008版)
- Raspberry Pi開發實戰