Building the Screen Header with Relative Layout

You know you want to display a TextView control for the screen title in the header. Wouldn't it be nice if you also included graphics on each side of the TextView control? This is a perfect time to try out RelativeLayout, which allows each child view to be placed in relation to the parent layout or other child view controls. Therefore, you can easily describe the header as a RelativeLayout control with three child layouts:

► An ImageView control aligned to the top left of the parent control

► A TextView control aligned to the top center of the parent control

► An ImageView control aligned to the top right of the parent control

Was this article helpful?

0 0

Post a comment