- 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.
推薦閱讀
- 密碼學(xué)原理與Java實現(xiàn)
- GraphQL學(xué)習(xí)指南
- PyTorch自動駕駛視覺感知算法實戰(zhàn)
- Visual C++實例精通
- Ext JS Data-driven Application Design
- 數(shù)據(jù)結(jié)構(gòu)習(xí)題精解(C語言實現(xiàn)+微課視頻)
- SQL語言從入門到精通
- 從零開始學(xué)C#
- 詳解MATLAB圖形繪制技術(shù)
- Tableau Desktop可視化高級應(yīng)用
- Clojure for Finance
- Tkinter GUI Programming by Example
- TypeScript High Performance
- JavaScript全棧開發(fā)
- Python程序設(shè)計