What is the baseline in RelativeLayout?

前端 未结 2 1564
攒了一身酷
攒了一身酷 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条回答
  •  醉酒成梦
    2020-12-08 13:13

    Here is a visual explanation that might clarify Cristian's answer:

    
        
        
    
    

    This code will look like this:

    Now, if I remove the android:layout_alignBaseline attribute, the same layout looks like this:

    It's interesting to observe that there is an impact on the orange view's height (in the first case the padding is not applied to the top of the view).

提交回复
热议问题