Trying to understand how the navigation drawer works.
Creating a Navigation Drawer
Download sample app
class MainActivity
- onCreate()
- setContentView()
- with R.layout.activity_main
- the name of the XML file called activity_main that contains the ID for
- drawer layout called drawer_layout
- frame layout called content_frame
- list view called left_drawer
- Set the contact view for the
activity_main.xml
- contains the id/drawer_layout id of the DrawerLayout
ContextThemeWrapper
Where is the title being set?
- it is coming from
- resource
- app_name
- called by getTitle()
We get some view and store them in the activities private variables
Set up the drawer list view for left_drawer
- create drawer layout view based on the view defined by left_drawer
- set the adapter for the list based on
- main activity class object (this)
- the drawer list item xml (drawer_list_item)
- planet titles array
- set the on item click listener based on a drawer item click listener class
When an item in the list is click, do the following:
- create a planet fragment
- Where ARG_PLANET_NUMBER is 'planet_number'
- this doesn't look like it is being used
- creating a fragment creates a view
Where are they setting the image?
Where are the images stored?
The images are stored under drawable
- earth.jpg
No comments:
Post a Comment