Android XML layouts
Learn containers, dimensions, IDs, and readable UI.
Choose the right size units
Use dp for layout sizes and spacing. Use sp for text sizes so Android can account for the user’s font settings.
Layouts position their children
LinearLayout places children along one axis. RelativeLayout positions siblings through relationships. Other layout systems need their own rules and tooling.
Give inputs a meaningful label
A visible TextView label can identify an EditText. A hint disappears as the user types, so a hint alone is not always enough.
Try it yourself
Open the XML Editor, load the sign-in example, and change its padding and text size. Try an invalid dimension to see the diagnostic.
Open the XML Editor

