Examples: • LinearLayout - aligns children horizontally or vertically. • RelativeLayout - positions children relative to siblings/parent. • ListView - for long lists of similar items.
Examples: • LinearLayout - aligns children horizontally or vertically. • RelativeLayout - positions children relative to siblings/parent. • ListView - for long lists of similar items. • GridView - for grids of similar items.
Examples: • LinearLayout - aligns children horizontally or vertically. • RelativeLayout - positions children relative to siblings/parent. • ListView - for long lists of similar items. • GridView - for grids of similar items. • ScrollView - wrapper for long content.
Examples: • LinearLayout - aligns children horizontally or vertically. • RelativeLayout - positions children relative to siblings/parent. • ListView - for long lists of similar items. • GridView - for grids of similar items. • ScrollView - wrapper for long content. • FrameLayout - dumb container for e.g. Fragments.
key=value format. layout_width and layout_height are required attributes. /> is a self-closing tag (no children). <View android:layout_width=”wrap_content” android:layout_height=”match_content” />
</...> to include children. <ViewGroup android:layout_width=”match_content” android:layout_height=”match_content”> <!-- ViewGroup children described here --> </ViewGroup>
a non-ViewGroup (e.g. text inside a TextView). • applying the same gravity to all children of a ViewGroup. Use layout_gravity for: • positioning children of a ViewGroup independently.
a non-ViewGroup (e.g. text inside a TextView). • applying the same gravity to all children of a ViewGroup. Use layout_gravity for: • positioning children of a ViewGroup independently.
right or top to bottom). Children specify their ‘weight’ within the LinearLayout. weight / weightSum = child size as proportion of parent size. android:orientation=”horizontal” android:orientation=”vertical” android:weightsum=”1” LinearLayout attributes:
Objects ↓ Adapter ‘converts’ each Object into an inflated layout ↓ ListView or GridView displays all those layouts Adapter is constructed and attached to ListView in code.
Objects ↓ Adapter ‘converts’ each Object into an inflated layout ↓ ListView or GridView displays all those layouts ListView is part of Activity or Fragment xml layout