To use a Toolbar you need to add the v7 appcompat library to your project

To use a toolbar you need to add the v7 appcompat

This preview shows page 73 - 78 out of 78 pages.

To use a Toolbar , you need to add the v7 appcompat library to your project. SwipeRefreshLayout A SwipeRefreshLayout is a useful View container for when your application supports vertical swipe gestures for updating the contents of your application. Your Activity must implement the OnRefreshListener to know how to handle the swipe gesture. To use the SwipeRefreshLayout , you need to add the v4 support library to your project.
Image of page 73

Subscribe to view the full document.

Exploring Other View Containers RecyclerView A RecyclerView is similar to a ListView container that provides more efficient scrolling when rendering a list that contains a large amount of data to display. To use a RecyclerView , you need to add the v7 recyclerview library to your project. We talk more about RecyclerView in Chapter 12 , “Embracing Material Design.” CardView A CardView is a FrameLayout container that allows you to apply rounded corners and shadows. To use a CardView , you need to add the v7 cardview library to your project. We talk more about CardView in Chapter 12, “Embracing Material Design.”
Image of page 74
Exploring Other View Containers ViewPager A ViewPager is a useful View container for when your application has many different pages of data and you need to support swiping left and right through that data. To use a ViewPager , you must create a PagerAdapte r that provides the data for the ViewPager . Fragments are typically used for paging data with ViewPager . DrawerLayout A layout pattern that has been embraced by the Android team is the DrawerLayout . This layout is especially useful for providing a list of navigation items that are hidden off the screen but presented when users swipe from the left or the right, or when they press the Home button from the action bar if the DrawerLayout resides to the left. DrawerLayout should really be used only for navigation and only when there are more than three top-level views within your application. To use the DrawerLayout, you must add the v4 support library to your project.
Image of page 75

Subscribe to view the full document.

Chapter 8 Summary We have learned how to create layouts using XML resources. We have learned how to create layouts programmatically. We have explored many useful ViewGroup and ViewGroup subclass attributes. We are now able to define the LinearLayout , FrameLayout , RelativeLayout , TableLayout , and GridLayout . We have learned how to place multiple layouts on a screen. We have learned about AdapterView controls and how to populate them with data. We have learned how to implement scrolling using the ScrollView control.
Image of page 76