- 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.
推薦閱讀
- Spring 5.0 Microservices(Second Edition)
- Hands-On Data Structures and Algorithms with JavaScript
- Apache Hive Essentials
- Mastering Kotlin
- Wireshark Network Security
- C語言程序設計
- 軟件架構:Python語言實現
- Python時間序列預測
- The Professional ScrumMaster’s Handbook
- AutoCAD 2009實訓指導
- Couchbase Essentials
- Penetration Testing with the Bash shell
- 微信公眾平臺服務號開發:揭秘九大高級接口
- SQL Server 2012數據庫管理與開發(慕課版)
- Selenium自動化測試實戰:基于Python