今天紀錄一下要怎麼調整TextView每個字與字之間的間距呢?
用TextView所提供的letterSpacing即可。
letterSpacing預設為0,最多可設定到小數點第二位,如:0.05,數值越大,間隔越大,也可以設定負數,負數的話,字與字越靠近。
可以透過XML設定或程式碼直接設定
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<TextView | |
android:letterSpacing="0.1" | |
... /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
textView.letterSpacing = 1f |