1 page.title=Support Library Features 2 3 @jd:body 4 5 <div id="qv-wrapper"> 6 <div id="qv"> 7 8 <h2>In this document</h2> 9 <ol> 10 <li><a href="#v4">v4 Support Library</a></li> 11 <li><a href="#v7">v7 Support Libraries</a> 12 <ol> 13 <li><a href="#v7-appcompat">v7 appcompat library</a></li> 14 <li><a href="#v7-cardview">v7 cardview library</a></li> 15 <li><a href="#v7-gridlayout">v7 gridlayout library</a></li> 16 <li><a href="#v7-mediarouter">v7 mediarouter library</a></li> 17 <li><a href="#v7-palette">v7 palette library</a></li> 18 <li><a href="#v7-recyclerview">v7 recyclerview library</a></li> 19 </ol> 20 </li> 21 <li><a href="#v8">v8 Support Library</a></li> 22 <li><a href="#v13">v13 Support Library</a></li> 23 <li><a href="#v17-leanback">v17 Leanback Library</a></li> 24 </ol> 25 26 <h2>See also</h2> 27 <ol> 28 <li><a href="{@docRoot}tools/support-library/index.html#revisions"> 29 Support Library Revisions</a></li> 30 <li><a href="{@docRoot}tools/support-library/setup.html"> 31 Support Library Setup</a></li> 32 </ol> 33 34 </div> 35 </div> 36 37 <p>The Android Support Library package contains several libraries that can be included 38 in your application. Each of these libraries supports a specific range of Android platform 39 versions and set of features.</p> 40 41 <p>This guide explains the important features and version support provided by the Support 42 Libraries to help you decide which of them you should include in your application. In general, 43 we recommend including the <a href="#v4">v4 support</a> and <a href="#v7-appcompat">v7 44 appcompat</a> libraries, because they support a wide range of 45 Android versions and provide APIs for recommended user interface patterns.</p> 46 47 <p>In order to use any of the following libraries, you must download the library files to your 48 Android SDK installation. Follow the directions for downloading the Support Libraries in 49 <a href="{@docRoot}tools/support-library/setup.html#download">Support Library Setup</a> to 50 complete this step. You must take additional steps to include a specific Support Library in 51 your application. See the end of each library section below for important information on how to 52 include the library in your application.</p> 53 54 55 <h2 id="v4">v4 Support Library</h2> 56 57 <p>This library is designed to be used with Android 1.6 (API level 4) and higher. It includes the 58 largest set of APIs compared to the other libraries, including support for application components, 59 user interface features, accessibility, data handling, network connectivity, and programming 60 utilities. Here are a few of the key classes included in the v4 library:</p> 61 62 <ul> 63 <li>App Components 64 <ul> 65 <li>{@link android.support.v4.app.Fragment} 66 - Adds support for encapsulation of user interface and functionality 67 with Fragments, enabling 68 applications to provide layouts that adjust between small and 69 large-screen devices. 70 </li> 71 72 <li>{@link android.support.v4.app.NotificationCompat} - Adds support for rich notification 73 features.</li> 74 <li>{@link android.support.v4.content.LocalBroadcastManager} - Allows applications to easily 75 register for and receive intents within a single application without broadcasting them 76 globally.</li> 77 </ul> 78 </li> 79 <li>User Interface 80 <ul> 81 <li>{@link android.support.v4.view.ViewPager} - Adds a 82 {@link android.view.ViewGroup} that manages the layout for the 83 child views, which the user can swipe between.</li> 84 <li>{@link android.support.v4.view.PagerTitleStrip} 85 - Adds a non-interactive title strip, that can be added as a child of 86 {@link android.support.v4.view.ViewPager}.</li> 87 <li>{@link android.support.v4.view.PagerTabStrip} - Adds a 88 navigation widget for switching between paged views, that can also be used with 89 {@link android.support.v4.view.ViewPager}.</li> 90 <li>{@link android.support.v4.widget.DrawerLayout} - Adds 91 support for creating a <a href="{@docRoot}training/implementing-navigation/nav-drawer.html" 92 >Navigation Drawer</a> that can be pulled in from the edge of a window.</li> 93 <li>{@link android.support.v4.widget.SlidingPaneLayout} 94 - Adds widget for creating linked summary and detail views that 95 appropriately adapt to various screen sizes.</li> 96 </ul> 97 </li> 98 <li>Accessibility 99 <ul> 100 <li>{@link android.support.v4.widget.ExploreByTouchHelper} 101 - Adds a helper class for implementing accessibility support for custom views.</li> 102 <li>{@link android.support.v4.view.accessibility.AccessibilityEventCompat} - Adds support for 103 {@link android.view.accessibility.AccessibilityEvent}. For more information about implementing 104 accessibility, see <a href="{@docRoot}guide/topics/ui/accessibility/index.html" 105 >Accessibility</a>.</li> 106 107 <li>{@link android.support.v4.view.accessibility.AccessibilityNodeInfoCompat} - Adds support 108 for {@link android.view.accessibility.AccessibilityNodeInfo}.</li> 109 <li>{@link android.support.v4.view.accessibility.AccessibilityNodeProviderCompat} - Adds 110 support for {@link android.view.accessibility.AccessibilityNodeProvider}.</li> 111 <li>{@link android.support.v4.view.AccessibilityDelegateCompat} - Adds support for 112 {@link android.view.View.AccessibilityDelegate}.</li> 113 </ul> 114 </li> 115 <li>Content 116 <ul> 117 <li>{@link android.support.v4.content.Loader} - Adds support for asynchronous loading of data. 118 The library also provides concrete implementations of this class, including 119 {@link android.support.v4.content.CursorLoader} and 120 {@link android.support.v4.content.AsyncTaskLoader}.</li> 121 <li>{@link android.support.v4.content.FileProvider} - Adds support for sharing of private 122 files between applications.</li> 123 </ul> 124 </li> 125 </ul> 126 127 <p> 128 There are many other APIs included in this library. For complete, detailed information about the 129 v4 Support Library APIs, see the {@link android.support.v4.app android.support.v4} package in the 130 API reference. 131 </p> 132 133 <p>This library is located in the {@code <sdk>/extras/android/support/v4/} directory after 134 you download the Android Support Libraries. The library does not contain user interface 135 resources. To include it in your application project, follow the instructions for 136 <a href="{@docRoot}tools/support-library/setup.html#libs-without-res">Adding libraries without 137 resources</a>.</p> 138 139 <p>The Gradle build script dependency identifier for this library is as follows:</p> 140 141 <pre> 142 com.android.support:support-v4:18.0.+ 143 </pre> 144 145 <p>This dependency notation specifies the release version 18.0.0 or higher.</p> 146 147 148 <h2 id="v7">v7 Support Libraries</h2> 149 150 <p>There are several libraries designed to be used with Android 2.1 (API level 7) and higher. 151 These libraries provide specific feature sets and can be included in your application 152 independently from each other.</p> 153 154 155 <h3 id="v7-appcompat">v7 appcompat library</h3> 156 157 <p>This library adds support for the 158 <a href="{@docRoot}guide/topics/ui/actionbar.html">Action Bar</a> user 159 interface <a href="{@docRoot}design/patterns/actionbar.html">design 160 pattern</a>. This library includes support for 161 <a href="{@docRoot}design/material/">material design</a> user interface 162 implementations. 163 </p> 164 165 <p class="note"><strong>Note:</strong> 166 This library depends on the v4 Support Library. If you are using Ant or Eclipse, make sure 167 you include the v4 Support Library as part of this library's classpath. 168 </p> 169 170 <p>Here are a few of the key classes included in the v7 appcompat library:</p> 171 172 <ul> 173 <li>{@link android.support.v7.app.ActionBar} - Provides an implementation of the action bar 174 <a href="{@docRoot}design/patterns/actionbar.html">user interface pattern</a>. For more 175 information on using the Action Bar, see the 176 <a href="{@docRoot}guide/topics/ui/actionbar.html">Action Bar</a> developer guide. 177 </li> 178 <li>{@link android.support.v7.app.ActionBarActivity} - Adds an application activity class that 179 must be used as a base class for activities that uses the Support Library action bar 180 implementation. 181 </li> 182 <li>{@link android.support.v7.widget.ShareActionProvider} - Adds support for a standardized 183 sharing action (such as email or posting to social applications) that can be included in an 184 action bar. 185 </li> 186 </ul> 187 188 <p>This library is located in the {@code <sdk>/extras/android/support/v7/appcompat/} 189 directory after you download the Android Support Libraries. The library contains user 190 interface resources. To include it in your application project, follow the instructions for 191 <a href="{@docRoot}tools/support-library/setup.html#libs-with-res">Adding libraries with 192 resources</a>.</p> 193 194 <p>The Gradle build script dependency identifier for this library is as follows:</p> 195 196 <pre> 197 com.android.support:appcompat-v7:21.0.+ 198 </pre> 199 200 <p>This dependency notation specifies the release version 21.0.0 or higher.</p> 201 202 <h3 id="v7-cardview">v7 cardview library</h3> 203 204 <p>This library adds support for the {@link android.support.v7.widget.CardView} 205 widget, which lets you show information inside cards that have a consistent look 206 on any app. These cards are useful for material design 207 implementations, and are used extensively in layouts for TV apps.</p> 208 209 <p>This library is located in the 210 {@code <sdk>/extras/android/support/v7/cardview/} directory after you 211 download the Android Support Libraries. The library contains user interface 212 resources. To include it in your application project, follow the instructions 213 for <a href="{@docRoot}tools/support-library/setup.html#libs-with-res">Adding 214 libraries with resources</a>.</p> 215 216 <p>The Gradle build script dependency identifier for this library is as follows:</p> 217 218 <pre> 219 com.android.support:cardview-v7:21.0.+ 220 </pre> 221 222 <p>This dependency notation specifies the release version 21.0.0 or higher.</p> 223 224 <h3 id="v7-gridlayout">v7 gridlayout library</h3> 225 226 <p>This library adds support for the {@link android.support.v7.widget.GridLayout} class, which 227 allows you to arrange user interface elements using a grid of rectangular cells. 228 For detailed information about the v7 gridlayout library APIs, see the 229 {@link android.support.v7.widget android.support.v7.widget} package in the API reference.</p> 230 231 <p>This library is located in the {@code <sdk>/extras/android/support/v7/gridlayout/} 232 directory after you download the Android Support Libraries. The library contains user 233 interface resources. To include it in your application project, follow the instructions for 234 <a href="{@docRoot}tools/support-library/setup.html#libs-with-res">Adding libraries with 235 resources</a>.</p> 236 237 <p>The Gradle build script dependency identifier for this library is as follows:</p> 238 239 <pre> 240 com.android.support:gridlayout-v7:18.0.+ 241 </pre> 242 243 <p>This dependency notation specifies the release version 18.0.0 or higher.</p> 244 245 246 <h3 id="v7-mediarouter">v7 mediarouter library</h3> 247 248 <p>This library provides {@link android.support.v7.media.MediaRouter}, {@link 249 android.support.v7.media.MediaRouteProvider}, and related media classes that 250 support <a href="https://developers.google.com/cast/docs/android_sender">Google Cast</a>. </p> 251 252 <p>In general, the APIs in the v7 mediarouter library provide a means of 253 controlling the routing of media channels and streams from the current device to 254 external screens, speakers, and other destination devices. The library includes 255 APIs for publishing app-specific media route providers, for discovering and 256 selecting destination devices, for checking media status, and more. For detailed 257 information about the v7 mediarouter library APIs, see the 258 {@link android.support.v7.media android.support.v7.media} package in the API 259 reference.</p> 260 261 <p>The v7 mediarouter library is located in the 262 <code><sdk>/extras/android/support/v7/mediarouter/</code> directory after 263 you download the Android Support Library. It's provided as a library project 264 with a dependency on the v7 appcompat library, so you'll need to include both 265 libraries in your build path when setting up your project. For more information 266 on how to set up your project, follow the instructions in <a 267 href="{@docRoot}tools/support-library/setup.html#libs-with-res">Adding libraries 268 with resources</a>. If you are developing in Eclipse/ADT, make sure to include 269 both the <code>android-support-v7-mediarouter.jar</code> and 270 <code>android-support-v7-appcompat.jar</code> files.</p> 271 272 <p>If you are using Android Studio, all you need to do is specify the Gradle build 273 script dependency identifier <code>com.android.support:support-v7-mediarouter:<revision></code>, 274 where "18.0.0" is the minimum revision at which the library is available. For example:</p> 275 276 <pre> 277 com.android.support:mediarouter-v7:18.0.+ 278 </pre> 279 280 <p class="caution">The v7 mediarouter library APIs introduced in Support Library 281 r18 are subject to change in later revisions of the Support Library. At this 282 time, we recommend using the library only in connection with <a 283 href="https://developers.google.com/cast/docs/android_sender">Google Cast</a>. </p> 284 285 <h3 id="v7-palette">v7 palette library</h3> 286 287 <p>The v7 palette support library includes the 288 {@link android.support.v7.graphics.Palette} class, which lets you extract 289 prominent colors from an image. For example, a music app could use a 290 {@link android.support.v7.graphics.Palette} object to extract the major colors 291 from an album cover, and use those colors to build a color-coordinated song 292 title card.</p> 293 294 <p>This library is located in the 295 {@code <sdk>/extras/android/support/v7/palette/} directory after 296 you download the Android Support Libraries. The library does not contain user interface 297 resources. To include it in your application project, follow the instructions for 298 <a href="{@docRoot}tools/support-library/setup.html#libs-without-res">Adding libraries without 299 resources</a>.</p> 300 301 <p>The Gradle build script dependency identifier for this library is as follows:</p> 302 303 <pre> 304 com.android.support:palette-v7:21.0.+ 305 </pre> 306 307 <p>This dependency notation specifies the release version 21.0.0 or higher.</p> 308 309 <h3 id="v7-recyclerview">v7 recyclerview library</h3> 310 311 <p>The recyclerview library adds the {@link android.support.v7.widget.RecyclerView} 312 class. This class provides support for the 313 <a href="{@docRoot}training/material/lists-cards.jd#RecyclerView">RecyclerView 314 widget</a>, a view for efficiently displaying large data sets by providing a 315 limited window of data items.</p> 316 317 <p>This library is located in the 318 {@code <sdk>/extras/android/support/v7/recyclerview/} directory after you 319 download the Android Support Libraries. The library contains user interface 320 resources. To include it in your application project, follow the instructions 321 for <a href="{@docRoot}tools/support-library/setup.html#libs-with-res">Adding 322 libraries with resources</a>.</p> 323 324 <p>The Gradle build script dependency identifier for this library is as follows:</p> 325 326 <pre> 327 com.android.support:recyclerview-v7:21.0.+ 328 </pre> 329 330 <p>This dependency notation specifies the release version 21.0.0 or higher.</p> 331 332 <h2 id="v8">v8 Support Library</h2> 333 334 <p>This library is designed to be used with Android (API level 8) and higher. It adds support for 335 the <a href="{@docRoot}guide/topics/renderscript/compute.html">RenderScript</a> computation 336 framework. These APIs are included in the {@link android.support.v8.renderscript} package. You 337 should be aware that the steps for including these APIs in your application is <em>very 338 different</em> from other support library APIs. For more information about using these APIs 339 in your application, see the 340 <a href="{@docRoot}guide/topics/renderscript/compute.html#access-rs-apis">RenderScript</a> 341 developer guide.</p> 342 343 <p class="note"> 344 <strong>Note:</strong> Use of RenderScript with the support library is supported with the Android 345 Eclipse plugin and Ant build tools. It is <em>not currently</em> supported with Android Studio or 346 Gradle-based builds. 347 </p> 348 349 350 <h2 id="v13">v13 Support Library</h2> 351 352 <p>This library is designed to be used for Android 3.2 (API level 13) and higher. It adds support 353 for the <a href="{@docRoot}guide/components/fragments.html">Fragment</a> user interface pattern 354 with the ({@link android.support.v13.app.FragmentCompat}) class and additional fragment support 355 classes. For more information about fragments, see the 356 <a href="{@docRoot}guide/components/fragments.html">Fragments</a> developer guide. For detailed 357 information about the v13 Support Library APIs, see the {@link android.support.v13.app 358 android.support.v13} package in the API reference. 359 </p> 360 361 <p>This library is located in the {@code <sdk>/extras/android/support/v13/} directory after 362 you download the Android Support Libraries. The library does not contain user interface 363 resources. To include it in your application project, follow the instructions for 364 <a href="{@docRoot}tools/support-library/setup.html#libs-without-res">Adding libraries without 365 resources</a>.</p> 366 367 <p>The Gradle build script dependency identifier for this library is as follows:</p> 368 369 <pre> 370 com.android.support:support-v13:18.0.+ 371 </pre> 372 373 <p>This dependency notation specifies the release version 18.0.0 or higher.</p> 374 375 <h2 id="v17-leanback">v17 Leanback Library</h2> 376 377 <p>The {@link android.support.v17.leanback} package provides APIs to support 378 building user interfaces 379 on TV devices. It provides a number of important widgets for TV apps. Some of the notable classes include:</p> 380 381 <ul> 382 <li>{@link android.support.v17.leanback.app.BrowseFragment} - A fragment for 383 creating a primary layout for browsing categories and rows of media 384 items.</li> 385 <li>{@link android.support.v17.leanback.app.DetailsFragment} - A wrapper 386 fragment for Leanback details screens.</li> 387 <li>{@link android.support.v17.leanback.app.PlaybackOverlayFragment} - A 388 subclass of {@link android.support.v17.leanback.app.DetailsFragment} for 389 displaying playback controls and related content.</li> 390 <li>{@link android.support.v17.leanback.app.SearchFragment} - A fragment to 391 handle searches. The fragment receives the user's search request and passes 392 it to the application-provided {@link 393 android.support.v17.leanback.app.SearchFragment.SearchResultProvider 394 SearchResultProvider}. The {@link 395 android.support.v17.leanback.app.SearchFragment.SearchResultProvider 396 SearchResultProvider} returns the search results to the 397 {@link android.support.v17.leanback.app.SearchFragment}, which renders them 398 into a {@link android.support.v17.leanback.app.RowsFragment}.</li> 399 </ul> 400 401 <p>This library is located in the 402 {@code <sdk>/extras/android/support/v17/leanback} directory after 403 you download the Android Support Libraries. For more information 404 on how to set up your project, follow the instructions in <a 405 href="{@docRoot}tools/support-library/setup.html#libs-with-res">Adding libraries 406 with resources</a>. </p> 407 408 <p>The Gradle build script dependency identifier for this library is as follows:</p> 409 410 <pre> 411 com.android.support:leanback-v17:21.0.+ 412 </pre> 413 414 <p>This dependency notation specifies the release version 21.0.0 or higher.</p> 415