Professional Documents
Culture Documents
• Components of a screen
1. Linear layout
2. Table layout
3. Relative layout
4. Frame layout
5. Scroll View
Basic Views
Lesson Objectives
TextView
• a place to display a text string.
EditText
• includes rich editing capabilities.
Spinner
ViewGroups
1. GridView
• descend from the AdapterView class
• displays many child Views that the user can
manipulate.
• two-dimensional array that the user can scroll
vertically.
ViewGroups
1. GridView
• int getCount
Returns the number of items in the data set represented by the Adapter.
• Object getItem(int position)
Returns the object in the Adapter function (Adapter class) at the given position.
• long getItem(int position)
Returns the row ID within the Adapter of the object at the given position.
• View getView(int position, View convertView, ViewGroup parent)
Returns a View object that will display the data in the given position in the data set.
ViewGroups
ListView
• enable to display a long list of items.
• similar to Gallery.
• uses a vertically scrolling list.
• To create a ListView that takes up the entire screen, Android provides the
ListActivity class.
• ListActivity class itself contains a ListView.
ViewGroups
2. ListView
ViewGroups
3. ScrollView
3. ScrollView
Summary
• Views
– TextView and EditText
– Button and ImageButton
– Adapters and AdapterViews
– CheckBoxes, RadioButtons, and
Spinners
• ViewGroups
– GridView
– ListView
– ScrollView
Activity
• Practice all the views and viewgroups using the sample codes uploaded in
Blackboard.