Android 9 Development Cookbook(Third Edition)
上QQ阅读APP看书,第一时间看更新

There's more...

Multiple attribute options can be combined using bitwise OR. (Java uses the pipe character (|) for OR). For example, we could combine two gravity options to both align along the top of the parent and center within the available space:

android:layout_gravity="top|center" 

It should be noted that the layout_gravity and gravity tags are not the same thing. Where layout_gravity dictates where in its parent a View should lie, gravity controls the positioning of the contents within a View, for example, the alignment of text on a button.