Implementation of spaces in Android layout and spaces occupying the width of one Chinese character

Use spaces in Android layouts to align text. So how to represent a space in Android?

  • Space:  
  • Narrow spaces:  

A space with the width of one Chinese character:     [When two spaces (  ) are used to occupy the width of one Chinese character, two spaces are slightly narrower than one Chinese character, three A space (   ) is slightly wider than a Chinese character]

In actual use, it is necessary to use the combination of   and   flexibly.

 Half a Chinese character is more accurate,
 A Chinese character is a little wider than a Chinese character.
Therefore, it is recommended to use   for Chinese alignment,
while     has different performances on different models.

android:text="real name : " 
android:text="body    parts    certificate:"

android:text="姓  ‒:" 
android:text=" ID card :"

 

The way TextView implements the first line indentation:

 

  • In the string resource file, add "\u3000\u3000" in front of the text to indent the first line
  • In Java code, use setText("\u3000\u3000"+xxxxx);

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326040132&siteId=291194637