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 Libraries</a> 11 <ol> 12 <li><a href="#v4-compat">v4 compat library</a></li> 13 <li><a href="#v4-core-utils">v4 core-utils library</a></li> 14 <li><a href="#v4-core-ui">v4 core-ui library</a></li> 15 <li><a href="#v4-media-compat">v4 media-compat library</a></li> 16 <li><a href="#v4-fragment">v4 fragment library</a></li> 17 </ol> 18 </li> 19 <li><a href="#multidex">Multidex Support Library</a></li> 20 <li><a href="#v7">v7 Support Libraries</a> 21 <ol> 22 <li><a href="#v7-appcompat">v7 appcompat library</a></li> 23 <li><a href="#v7-cardview">v7 cardview library</a></li> 24 <li><a href="#v7-gridlayout">v7 gridlayout library</a></li> 25 <li><a href="#v7-mediarouter">v7 mediarouter library</a></li> 26 <li><a href="#v7-palette">v7 palette library</a></li> 27 <li><a href="#v7-recyclerview">v7 recyclerview library</a></li> 28 <li><a href="#v7-preference">v7 preference library</a></li> 29 </ol> 30 </li> 31 <li><a href="#v8">v8 Support Library</a></li> 32 <li><a href="#v13">v13 Support Library</a></li> 33 <li><a href="#v14-preference">v14 Preference Support Library</a></li> 34 <li><a href="#v17-leanback">v17 Leanback Library</a></li> 35 <li><a href="#v17-preference">v17 Preference Library for TV</a></li> 36 <li><a href="#annotations">Annotations Support Library</a></li> 37 <li><a href="#design">Design Support Library</a></li> 38 <li><a href="#custom-tabs">Custom Tabs Support Library</a></li> 39 <li><a href="#percent">Percent Support Library</a></li> 40 <li><a href="#recommendation">Recommendation Support Library for TV</a></li> 41 </ol> 42 43 <h2>See also</h2> 44 <ol> 45 <li><a href="{@docRoot}topic/libraries/support-library/index.html#revisions"> 46 Support Library Revisions</a></li> 47 <li><a href="{@docRoot}topic/libraries/support-library/setup.html"> 48 Support Library Setup</a></li> 49 <li><a href="{@docRoot}topic/libraries/testing-support-library/index.html"> 50 Testing Support Library</a></li> 51 </ol> 52 53 </div> 54 </div> 55 56 <p>The Android Support Library package contains several libraries that can be included 57 in your application. Each of these libraries supports a specific range of Android platform 58 versions and set of features.</p> 59 60 <p>This guide explains the important features and version support provided by the Support 61 Libraries to help you decide which of them you should include in your application. In general, 62 we recommend including the <a href="#v4">v4 support</a> and <a href="#v7-appcompat">v7 63 appcompat</a> libraries, because they support a wide range of 64 Android versions and provide APIs for recommended user interface patterns.</p> 65 66 <p>In order to use any of the following libraries, you must download the library files to your 67 Android SDK installation. Follow the directions for downloading the Support Libraries in 68 <a href="{@docRoot}tools/support-library/setup.html#download">Support Library Setup</a> to 69 complete this step. You must take additional steps to include a specific Support Library in 70 your application. See the end of each library section below for important information on how to 71 include the library in your application.</p> 72 73 74 <h2 id="v4">v4 Support Libraries</h2> 75 76 <p> 77 These libraries are designed to be used with Android 2.3 (API level 9) and 78 higher. They include the largest set of APIs compared to the other libraries, 79 including support for application components, user interface features, 80 accessibility, data handling, network connectivity, and programming 81 utilities. 82 </p> 83 84 <p> 85 For complete, detailed information about the classes and methods provided by 86 the v4 support libraries, see the {@link android.support.v4.app 87 android.support.v4} package in the API reference. 88 </p> 89 90 91 <p class="note"> 92 <strong>Note:</strong> Prior to Support Library revision 24.2.0, there was a 93 single v4 support library. That library was divided into multiple modules to 94 improve efficiency. For backwards compatibility, if you list 95 <code>support-v4</code> in your Gradle script, your APK will include all of 96 the v4 modules. However, to reduce APK size, we recommend that you just list 97 the specific modules your app needs. 98 </p> 99 100 <h3 id="v4-compat">v4 compat library</h3> 101 102 <p> 103 Provides compatibility wrappers for a number of framework APIs, such as 104 <code>Context.obtainDrawable()</code> and 105 <code>View.performAccessibilityAction()</code>. 106 </p> 107 108 <p>The Gradle build script dependency identifier for this library is as follows:</p> 109 110 <pre> 111 com.android.support:support-compat:24.2.0 112 </pre> 113 114 <h3 id="v4-core-utils">v4 core-utils library</h3> 115 116 <p> 117 Provides a number of utility classes, such as {@link 118 android.support.v4.content.AsyncTaskLoader} and {@link 119 android.support.v4.content.PermissionChecker}. 120 </p> 121 122 <p> 123 The Gradle build script dependency identifier for this library is as follows: 124 </p> 125 126 <pre> 127 com.android.support:support-core-utils:24.2.0 128 </pre> 129 130 <h3 id="v4-core-ui">v4 core-ui library</h3> 131 132 <p> 133 Implements a variety of UI-related components, such as {@link 134 android.support.v4.view.ViewPager}, {@link 135 android.support.v4.widget.NestedScrollView}, and {@link 136 android.support.v4.widget.ExploreByTouchHelper}. 137 </p> 138 139 <p> 140 The Gradle build script dependency identifier for this library is as follows: 141 </p> 142 143 <pre> 144 com.android.support:support-core-ui:24.2.0 145 </pre> 146 147 <h3 id="v4-media-compat">v4 media-compat library</h3> 148 149 <p> 150 Backports portions of the <a href= 151 "/reference/android/media/package-summary.html">media</a> framework, 152 including {@link android.media.browse.MediaBrowser} and {@link 153 android.media.session.MediaSession}. 154 </p> 155 156 <p> 157 The Gradle build script dependency identifier for this library is as follows: 158 </p> 159 160 <pre> 161 com.android.support:support-media-compat:24.2.0 162 </pre> 163 164 <h3 id="v4-fragment">v4 fragment library</h3> 165 166 <p> 167 Adds support for encapsulation of user interface and functionality with 168 <a href= 169 "/guide/components/fragments.html">fragments</a>, 170 enabling applications to provide layouts that adjust between small and 171 large-screen devices. This module has dependencies on <a href= 172 "#v4-compat">compat</a>, <a href="#v4-core-utils">core-utils</a>, <a href= 173 "#v4-core-ui">core-ui</a>, and <a href="#v4-media-compat">media-compat</a>. 174 </p> 175 176 <p> 177 The Gradle build script dependency identifier for this library is as follows: 178 </p> 179 180 <pre> 181 com.android.support:support-fragment:24.2.0 182 </pre> 183 184 <h2 id="multidex">Multidex Support Library</h2> 185 186 <p> 187 This library provides support for building apps with multiple Dalvik Executable (DEX) files. 188 Apps that reference more than 65536 methods are required to use multidex configurations. For 189 more information about using multidex, see <a href="{@docRoot}tools/building/multidex.html"> 190 Building Apps with Over 64K Methods</a>. 191 </p> 192 193 <p> 194 The Gradle build script dependency identifier for this library is as follows: 195 </p> 196 197 <pre> 198 com.android.support:multidex:1.0.0 199 </pre> 200 201 202 203 <h2 id="v7">v7 Support Libraries</h2> 204 205 <p>There are several libraries designed to be used with Android 2.3 (API level 9) and higher. 206 These libraries provide specific feature sets and can be included in your application 207 independently from each other.</p> 208 209 210 <h3 id="v7-appcompat">v7 appcompat library</h3> 211 212 <p>This library adds support for the 213 <a href="{@docRoot}guide/topics/ui/actionbar.html">Action Bar</a> user 214 interface <a href="{@docRoot}design/patterns/actionbar.html">design 215 pattern</a>. This library includes support for 216 <a href="{@docRoot}design/material/">material design</a> user interface 217 implementations. 218 </p> 219 220 <p class="note"><strong>Note:</strong> 221 This library depends on the v4 Support Library. 222 </p> 223 224 <p>Here are a few of the key classes included in the v7 appcompat library:</p> 225 226 <ul> 227 <li>{@link android.support.v7.app.ActionBar} - Provides an implementation of the action bar 228 <a href="{@docRoot}design/patterns/actionbar.html">user interface pattern</a>. For more 229 information on using the Action Bar, see the 230 <a href="{@docRoot}guide/topics/ui/actionbar.html">Action Bar</a> developer guide. 231 </li> 232 <li>{@link android.support.v7.app.AppCompatActivity} - Adds an application activity class that can 233 be used as a base class for activities that use the Support Library action bar 234 implementation. 235 </li> 236 <li>{@link android.support.v7.app.AppCompatDialog} - Adds a dialog class that can be used as a base 237 class for AppCompat themed dialogs. 238 </li> 239 <li>{@link android.support.v7.widget.ShareActionProvider} - Adds support for a standardized 240 sharing action (such as email or posting to social applications) that can be included in an 241 action bar. 242 </li> 243 </ul> 244 245 <p>The Gradle build script dependency identifier for this library is as follows:</p> 246 247 <pre> 248 com.android.support:appcompat-v7:24.2.0 249 </pre> 250 251 252 253 <h3 id="v7-cardview">v7 cardview library</h3> 254 255 <p>This library adds support for the {@link android.support.v7.widget.CardView} 256 widget, which lets you show information inside cards that have a consistent look 257 on any app. These cards are useful for material design 258 implementations, and are used extensively in layouts for TV apps.</p> 259 260 <p>The Gradle build script dependency identifier for this library is as follows:</p> 261 262 <pre> 263 com.android.support:cardview-v7:24.2.0 264 </pre> 265 266 267 268 <h3 id="v7-gridlayout">v7 gridlayout library</h3> 269 270 <p>After you download the Android Support Libraries, this library adds support for the 271 {@link android.support.v7.widget.GridLayout} class, which 272 allows you to arrange user interface elements using a grid of rectangular cells. 273 For detailed information about the v7 gridlayout library APIs, see the 274 {@link android.support.v7.widget android.support.v7.widget} package in the API reference.</p> 275 276 <p>The Gradle build script dependency identifier for this library is as follows:</p> 277 278 <pre> 279 com.android.support:gridlayout-v7:24.2.0 280 </pre> 281 282 283 284 <h3 id="v7-mediarouter">v7 mediarouter library</h3> 285 286 <p>This library provides {@link android.support.v7.media.MediaRouter}, {@link 287 android.support.v7.media.MediaRouteProvider}, and related media classes that 288 support <a href="https://developers.google.com/cast/docs/android_sender">Google Cast</a>. </p> 289 290 <p>In general, the APIs in the v7 mediarouter library provide a means of 291 controlling the routing of media channels and streams from the current device to 292 external screens, speakers, and other destination devices. The library includes 293 APIs for publishing app-specific media route providers, for discovering and 294 selecting destination devices, for checking media status, and more. For detailed 295 information about the v7 mediarouter library APIs, see the 296 {@link android.support.v7.media android.support.v7.media} package in the API 297 reference.</p> 298 299 <p>The Gradle build script dependency identifier for this library is as follows:</p> 300 301 <pre> 302 com.android.support:mediarouter-v7:24.2.0 303 </pre> 304 305 <p class="caution">The v7 mediarouter library APIs introduced in Support Library 306 r18 are subject to change in later revisions of the Support Library. At this 307 time, we recommend using the library only in connection with <a 308 href="https://developers.google.com/cast/docs/android_sender">Google Cast</a>. </p> 309 310 <h3 id="v7-palette">v7 palette library</h3> 311 312 <p>The v7 palette support library includes the 313 {@link android.support.v7.graphics.Palette} class, which lets you extract 314 prominent colors from an image. For example, a music app could use a 315 {@link android.support.v7.graphics.Palette} object to extract the major colors 316 from an album cover, and use those colors to build a color-coordinated song 317 title card.</p> 318 319 <p>The Gradle build script dependency identifier for this library is as follows:</p> 320 321 <pre> 322 com.android.support:palette-v7:24.2.0 323 </pre> 324 325 326 327 <h3 id="v7-recyclerview">v7 recyclerview library</h3> 328 329 <p>The recyclerview library adds the {@link android.support.v7.widget.RecyclerView} 330 class. This class provides support for the 331 <a href="{@docRoot}training/material/lists-cards.html">RecyclerView</a> 332 widget, a view for efficiently displaying large data sets by providing a 333 limited window of data items.</p> 334 335 <p>The Gradle build script dependency identifier for this library is as follows:</p> 336 337 <pre> 338 com.android.support:recyclerview-v7:24.2.0 339 </pre> 340 341 342 <h3 id="v7-preference">v7 Preference Support Library</h3> 343 344 <p>The 345 <a href="{@docRoot}reference/android/support/v7/preference/package-summary.html">preference</a> 346 package provides APIs to support adding preference objects, such as 347 {@link android.support.v7.preference.CheckBoxPreference} and 348 {@link android.support.v7.preference.ListPreference}, for 349 users to modify UI settings. </p> 350 351 <p>The v7 Preference library adds support for interfaces, such as 352 {@link android.support.v7.preference.Preference.OnPreferenceChangeListener} and 353 {@link android.support.v7.preference.Preference.OnPreferenceClickListener}, and classes, 354 such as {@link android.support.v7.preference.CheckBoxPreference} and 355 {@link android.support.v7.preference.ListPreference}. </p> 356 357 358 <p>The Gradle build script dependency identifier for this library is as follows:</p> 359 360 <pre> 361 com.android.support:preference-v7:24.2.0 362 </pre> 363 364 <h2 id="v8">v8 Support Library</h2> 365 366 <p>This library is designed to be used with Android 2.3 (API level 9) and higher. 367 This library provides specific feature sets and can be included in your application 368 independently from other libraries.</p> 369 370 <h3 id="v8-renderscript">v8 renderscript library</h3> 371 372 <p>This library is designed to be used with Android 2.3 (API level 9) and higher. It adds support for 373 the <a href="{@docRoot}guide/topics/renderscript/compute.html">RenderScript</a> computation 374 framework. These APIs are included in the {@link android.support.v8.renderscript} package. You 375 should be aware that the steps for including these APIs in your application is <em>very 376 different</em> from other support library APIs. For more information about using these APIs 377 in your application, see the 378 <a href="{@docRoot}guide/topics/renderscript/compute.html#access-rs-apis">RenderScript</a> 379 developer guide.</p> 380 381 <p class="note"> 382 <strong>Note:</strong> Use of RenderScript with the support library is supported with Android 383 Studio and Gradle-based builds. The 384 renderscript library is located in the <code>build-tools/$VERSION/renderscript/</code> folder. 385 </p> 386 387 <p>The following example shows the Gradle build script properties for this library:</p> 388 389 <pre> 390 defaultConfig { 391 renderscriptTargetApi 18 392 renderscriptSupportModeEnabled true 393 } 394 </pre> 395 396 397 398 <h2 id="v13">v13 Support Library</h2> 399 400 <p>This library is designed to be used for Android 3.2 (API level 13) and higher. It adds support 401 for the <a href="{@docRoot}guide/components/fragments.html">Fragment</a> user interface pattern 402 with the ({@link android.support.v13.app.FragmentCompat}) class and additional fragment support 403 classes. For more information about fragments, see the 404 <a href="{@docRoot}guide/components/fragments.html">Fragments</a> developer guide. For detailed 405 information about the v13 Support Library APIs, see the {@link android.support.v13.app 406 android.support.v13} package in the API reference. 407 </p> 408 409 <p>The Gradle build script dependency identifier for this library is as follows:</p> 410 411 <pre> 412 com.android.support:support-v13:24.2.0 413 </pre> 414 415 416 417 418 419 <h2 id="v14-preference">v14 Preference Support Library</h2> 420 421 422 <p>The {@link android.support.v14.preference} package provides APIs to add support 423 for preference interfaces such as 424 {@link android.support.v14.preference.PreferenceFragment.OnPreferenceStartFragmentCallback} 425 and 426 {@link android.support.v14.preference.PreferenceFragment.OnPreferenceStartScreenCallback}, 427 along with classes, such as 428 {@link android.support.v14.preference.MultiSelectListPreference} and 429 {@link android.support.v14.preference.PreferenceFragment}. For detailed 430 information about the v14 Preference Support Library APIs, see the 431 <a href="{@docRoot}reference/android/support/v14/preference/package-summary.html">preference</a> 432 package in the API reference. 433 </p> 434 435 <p>The Gradle build script dependency identifier for this library is as follows:</p> 436 437 <pre> 438 com.android.support:preference-v14:24.2.0 439 </pre> 440 441 442 443 444 <h2 id="v17-preference">v17 Preference Support Library for TV</h2> 445 446 447 <p>The {@link android.support.v17.preference} package provides APIs for providing preference 448 interfaces on TV devices, including support for the 449 {@link android.support.v17.preference.LeanbackListPreferenceDialogFragment.ViewHolder.OnItemClickListener} 450 interface and classes, such as 451 {@link android.support.v17.preference.BaseLeanbackPreferenceFragment} and 452 {@link android.support.v17.preference.LeanbackPreferenceFragment}. For detailed 453 information about the v17 Preference Support Library APIs, see the 454 <a href="{@docRoot}reference/android/support/v17/preference/package-summary.html">preference</a> 455 package in the API reference. 456 </p> 457 458 <p>The Gradle build script dependency identifier for this library is as follows:</p> 459 460 <pre> 461 com.android.support:preference-leanback-v17:24.2.0 462 </pre> 463 464 465 466 467 468 <h2 id="v17-leanback">v17 Leanback Library</h2> 469 470 <p>The {@link android.support.v17.leanback} package provides APIs to support 471 building user interfaces 472 on TV devices. It provides a number of important widgets for TV apps. Some of the notable classes include:</p> 473 474 <ul> 475 <li>{@link android.support.v17.leanback.app.BrowseFragment} - A fragment for 476 creating a primary layout for browsing categories and rows of media 477 items.</li> 478 <li>{@link android.support.v17.leanback.app.DetailsFragment} - A wrapper 479 fragment for Leanback details screens.</li> 480 <li>{@link android.support.v17.leanback.app.PlaybackOverlayFragment} - A 481 subclass of {@link android.support.v17.leanback.app.DetailsFragment} for 482 displaying playback controls and related content.</li> 483 <li>{@link android.support.v17.leanback.app.SearchFragment} - A fragment to 484 handle searches. The fragment receives the user's search request and passes 485 it to the application-provided {@link 486 android.support.v17.leanback.app.SearchFragment.SearchResultProvider 487 SearchResultProvider}. The {@link 488 android.support.v17.leanback.app.SearchFragment.SearchResultProvider 489 SearchResultProvider} returns the search results to the 490 {@link android.support.v17.leanback.app.SearchFragment}, which renders them 491 into a {@link android.support.v17.leanback.app.RowsFragment}.</li> 492 </ul> 493 494 <p>The Gradle build script dependency identifier for this library is as follows:</p> 495 496 <pre> 497 com.android.support:leanback-v17:24.2.0 498 </pre> 499 500 501 502 <h2 id="annotations">Annotations Support Library</h2> 503 504 <p>The <a href="{@docRoot}reference/android/support/annotation/package-summary.html">Annotation</a> 505 package provides APIs to support adding annotation metadata to your apps. </p> 506 507 <p></p> 508 509 <p>The Gradle build script dependency identifier for this library is as follows:</p> 510 511 <pre> 512 com.android.support:support-annotations:24.2.0 513 </pre> 514 515 516 517 <h2 id="design">Design Support Library</h2> 518 519 <p>The 520 <a href="{@docRoot}reference/android/support/design/package-summary.html">Design</a> package 521 provides APIs to support adding material design components and patterns to your apps. </p> 522 523 <p>The Design Support library adds support for various material design components and patterns for 524 app developers to build upon, such as navigation drawers, floating action buttons (<i>FAB</i>), 525 snackbars, and <a href="{@docRoot}design/building-blocks/tabs.html">tabs</a>. </p> 526 527 <p>The Gradle build script dependency identifier for this library is as follows:</p> 528 529 <pre> 530 com.android.support:design:24.2.0 531 </pre> 532 533 534 535 <h2 id="custom-tabs">Custom Tabs Support Library</h2> 536 537 <p>The 538 <a href="{@docRoot}reference/android/support/customtabs/package-summary.html">Custom Tabs</a> 539 package provides APIs to support adding and managing custom tabs in your apps. </p> 540 541 <p>The Custom Tabs Support library adds support for various classes, such as 542 <a href="{@docRoot}reference/android/support/customtabs/CustomTabsService.html">Custom Tabs 543 Service</a> 544 and 545 <a href="{@docRoot}reference/android/support/customtabs/CustomTabsCallback.html">Custom Tabs 546 Callback</a>. </p> 547 548 <p>The Gradle build script dependency identifier for this library is as follows:</p> 549 550 <pre> 551 com.android.support:customtabs:24.2.0 552 </pre> 553 554 555 556 557 <h2 id="percent">Percent Support Library</h2> 558 559 <p>The 560 <a href="{@docRoot}reference/android/support/percent/package-summary.html">Percent</a> 561 package provides APIs to support adding and managing percentage based dimensions in your app. </p> 562 563 <p>The Percent Support library adds support for the 564 <a href="{@docRoot}reference/android/support/percent/PercentLayoutHelper.PercentLayoutParams.html"> 565 PercentLayoutHelper.PercentLayoutParams</a> interface 566 and various classes, such as 567 <a href="{@docRoot}reference/android/support/percent/PercentFrameLayout.html">PercentFrameLayout</a> 568 and 569 <a href="{@docRoot}reference/android/support/percent/PercentRelativeLayout.html"> 570 PercentRelativeLayout</a>. </p> 571 572 <p>The Gradle build script dependency identifier for this library is as follows:</p> 573 574 <pre> 575 com.android.support:percent:24.2.0 576 </pre> 577 578 579 580 <h2 id="recommendation">App Recommendation Support Library for TV</h2> 581 582 <p>The 583 <a href="{@docRoot}reference/android/support/app/recommendation/package-summary.html">App 584 Recommendation</a> 585 package provides APIs to support adding content recommendations in your app running on TV devices. </p> 586 587 <p>The App library adds support for annotations, such as 588 <a href="{@docRoot}reference/android/support/app/recommendation/ContentRecommendation.ContentMaturity.html"> 589 ContentRecommendation.ContentMaturity</a> and various classes, such as 590 <a href="{@docRoot}reference/android/support/app/recommendation/ContentRecommendation.html">ContentRecommendation</a> 591 and 592 <a href="{@docRoot}reference/android/support/app/recommendation/RecommendationExtender.html"> 593 RecommendationExtender</a>. </p> 594 595 <p>The Gradle build script dependency identifier for this library is as follows:</p> 596 597 <pre> 598 com.android.support:recommendation:24.2.0 599 </pre> 600