What is the baseline in RelativeLayout?

前端 未结 2 1557
攒了一身酷
攒了一身酷 2020-12-08 13:06

What does \"baseline\" refer to when used in the context of a relative layout? Simple question, probably, but the documentation and google offer no hints.

2条回答
  •  Happy的楠姐
    2020-12-08 13:17

    The term baseline comes from typography. It's the invisible line letters in text sit on.

    For example, imagine you put two TextView elements next to each other. You give the second TextView a big padding (say 20dp). If you add layout_alignBaseline to the second element, the text will "scoot up" to align with the baseline of the first element. The text from both elements will appear as if they were written on the same invisible line.

    
      
      
    
    

提交回复
热议问题