Android 支持库软件包含能够添加至应用的多个库。每一个库均支持特定范围的 Android 平台版本和功能。html
本指南介绍了各支持库提供的重要功能和版本支持,从而帮助您决定在应用中添加哪些支持库。通常而言,咱们建议添加 v4 支持库和 v7 appcompat 库,由于它们支持一系列 Android 版本,而且能够为推荐的用户界面模式提供 API。java
要使用如下任一库,您必须将库文件下载到 Android SDK 安装位置中。请按照支持库设置中下载支持库的说明完成此步骤。要在应用中添加特定支持库,您还必须执行其余步骤。有关如何在应用中添加支持库的重要信息,请参阅下面各个库内容的末尾部分。react
这些库旨在与 Android 2.3(API 级别 9)及更高版本搭配使用。与其余支持库相比,它们包含的 API 集合最大,包括对应用组件、用户界面功能、辅助功能、数据处理、网络链接以及编程实用工具的支持。android
如需了解有关 v4 支持库所提供类和方法的完整详细信息,请参阅 API 参考中的 android.support.v4
软件包。ios
注:在支持库修订版 24.2.0 以前,存在一个 v4 支持库。为了提升效率,此库拆分红多个模块。出于向后兼容的考虑,若是您在 Gradle 脚本中列出了 support-v4
,您的 APK 将包含全部的 v4 模块。不过,要减小 APK 大小,咱们建议仅列出应用须要的特定模块。web
为众多框架 API 提供兼容性包装器,例如 Context.obtainDrawable()
和 View.performAccessibilityAction()
。spring
此库的 Gradle 构建脚本依赖关系标识符以下所示:chrome
com.android.support:support-compat:24.2.0
提供大量实用程序类,例如 AsyncTaskLoader
和 PermissionChecker
。express
此库的 Gradle 构建脚本依赖关系标识符以下所示:编程
com.android.support:support-core-utils:24.2.0
实现各类 UI 相关组件,例如 ViewPager
、NestedScrollView
和 ExploreByTouchHelper
。
此库的 Gradle 构建脚本依赖关系标识符以下所示:
com.android.support:support-core-ui:24.2.0
向后移植部分媒体框架,包括 MediaBrowser
和 MediaSession
。
此库的 Gradle 构建脚本依赖关系标识符以下所示:
com.android.support:support-media-compat:24.2.0
添加对使用片断封装用户界面和功能的支持,从而使应用可以提供能够在大屏幕设备与小屏幕设备之间进行调节的布局。此模块依赖于 compat、core-utils、core-ui 和 media-compat。
此库的 Gradle 构建脚本依赖关系标识符以下所示:
com.android.support:support-fragment:24.2.0
此库能够为使用多个 Dalvik Executable (DEX) 文件开发应用提供支持。引用超过 65536 个方法的应用须使用 Dalvik 可执行文件分包配置。如需了解有关使用 Dalvik 可执行文件分包的详细信息,请参阅使用超过 6.4 万种方法开发应用。
此库的 Gradle 构建脚本依赖关系标识符以下所示:
com.android.support:multidex:1.0.0
一些库旨在与 Android 2.3(API 级别 9)及更高版本搭配使用。这些库提供了特定的功能集,而且能够单独添加到应用中,与其余库互不影响。
此库添加了对操做栏用户界面设计模式的支持。此库包含对 Material Design 用户界面实现的支持。
注:此库依赖于 v4 支持库。
下面是 v7 appcompat 库中包含的一些关键类:
ActionBar
- 提供操做栏用户界面模式的实现。如需了解有关使用操做栏的详细信息,请参阅操做栏开发者指南。AppCompatActivity
- 添加一个应用 Activity 类,此类可做为使用支持库操做栏实现的 Activity 的基础类。AppCompatDialog
- 添加一个对话框类,此类可做为 AppCompat 主题对话框的基础类。ShareActionProvider
- 包含对能够添加到操做栏中的标准化分享操做(例如电子邮件或发帖至社交应用)的支持。此库的 Gradle 构建脚本依赖关系标识符以下所示:
com.android.support:appcompat-v7:24.2.0
此库添加了对 CardView
小部件的支持,让您可以在卡片内显示信息,从而使应用具有一致的外观。这些卡片对 Material Design 实现很是有用,并在电视应用布局中广为使用。
此库的 Gradle 构建脚本依赖关系标识符以下所示:
com.android.support:cardview-v7:24.2.0
下载 Android 支持库后,此库能够添加对 GridLayout
类的支持,让您可以使用网状方格安排用户界面元素。如需了解有关 v7 gridlayout 库 API 的详细信息,请参阅 API 参考中的 android.support.v7.widget
软件包。
此库的 Gradle 构建脚本依赖关系标识符以下所示:
com.android.support:gridlayout-v7:24.2.0
此库能够提供 MediaRouter
、MediaRouteProvider
和支持 Google Cast 的相关媒体类。
通常而言,利用 v7 mediarouter 库中的 API,您能够控制当前设备到外部屏幕、扬声器和其余目标设备的媒体渠道和流的路由。此库包含的 API 能够用于发布应用特定的媒体路由提供程序、发现和选择目标设备,以及检查媒体状态,等等。如需了解有关 v7 mediarouter 库 API 的详细信息,请参阅 API 参考中的 android.support.v7.media
软件包。
此库的 Gradle 构建脚本依赖关系标识符以下所示:
com.android.support:mediarouter-v7:24.2.0
支持库 r18 中引入的 v7 mediarouter 库 API 在后续版本的支持库中可能会发生更改。目前,咱们建议仅使用与 Google Cast 有关的库。
v7 palette 支持库包含 Palette
类,此类让您能够从图像中抽取突出颜色。例如,音乐应用可使用 Palette
对象从专辑封面抽取主要颜色,而后使用这些颜色建立一个色彩协调的歌曲标题卡。
此库的 Gradle 构建脚本依赖关系标识符以下所示:
com.android.support:palette-v7:24.2.0
recyclerview 库添加了 RecyclerView
类。此类可以为 RecyclerView 小部件提供支持,RecyclerView 是一种经过提供有限的数据项窗口有效显示大数据集的视图。
此库的 Gradle 构建脚本依赖关系标识符以下所示:
com.android.support:recyclerview-v7:24.2.0
首选项软件包提供的 API 支持添加 preference 对象(例如 CheckBoxPreference
和 ListPreference
),方便用户修改 UI 设置。
v7 Preference 库添加了对接口(例如 Preference.OnPreferenceChangeListener
和 Preference.OnPreferenceClickListener
)以及类(例如 CheckBoxPreference
和 ListPreference
)的支持。
此库的 Gradle 构建脚本依赖关系标识符以下所示:
com.android.support:preference-v7:24.2.0
此库旨在与 Android 2.3(API 级别 9)及更高版本搭配使用。此库提供了特定的功能集,而且能够单独添加到应用中,与其余库互不影响。
此库旨在与 Android 2.3(API 级别 9)及更高版本搭配使用。它添加了对 RenderScript 计算框架的支持。android.support.v8.renderscript
软件包中包含这些 API。请注意,在应用中添加这些 API 的步骤与添加其余支持库 API 迥然不一样。如需了解有关在应用中使用这些 API 的详细信息,请参阅 RenderScript 开发者指南。
注:Android Studio 和 Gradle 构建支持使用带支持库的 RenderScript。renderscript 库位于 build-tools/$VERSION/renderscript/
文件夹中。
如下示例显示了此库的 Gradle 构建脚本属性:
defaultConfig {
renderscriptTargetApi 18
renderscriptSupportModeEnabled true
}
此库旨在用于 Android 3.2(API 级别 13)及更高版本。它添加了对带有 (FragmentCompat
) 类和其余片断支持类的 Fragment 用户界面模式的支持。如需了解有关片断的详细信息,请参阅片断开发者指南。如需了解有关 v13 支持库 API 的详细信息,请参阅 API 参考中的 android.support.v13
软件包。
此库的 Gradle 构建脚本依赖关系标识符以下所示:
com.android.support:support-v13:24.2.0
android.support.v14.preference
软件包提供的 API 添加了对首选项接口(例如 PreferenceFragment.OnPreferenceStartFragmentCallback
和 PreferenceFragment.OnPreferenceStartScreenCallback
)以及类(例如 MultiSelectListPreference
和 PreferenceFragment
)的支持。如需了解有关 v14 Preference 支持库 API 的详细信息,请参阅 API 参考中的首选项软件包。
此库的 Gradle 构建脚本依赖关系标识符以下所示:
com.android.support:preference-v14:24.2.0
android.support.v17.preference
软件包提供的 API 能够在电视设备上提供首选项接口,包括对 LeanbackListPreferenceDialogFragment.ViewHolder.OnItemClickListener
接口和类的支持,例如 BaseLeanbackPreferenceFragment
和 LeanbackPreferenceFragment
。如需了解有关 v17 Preference 支持库 API 的详细信息,请参阅 API 参考中的首选项软件包。
此库的 Gradle 构建脚本依赖关系标识符以下所示:
com.android.support:preference-leanback-v17:24.2.0
android.support.v17.leanback
软件包提供的 API 支持在电视设备上构建用户界面。它为电视应用提供了一些重要的小部件。一些值得注意的类包括:
BrowseFragment
- 一种用于建立主要布局的片断,主要布局用于浏览类别和媒体项目。DetailsFragment
- 用于 Leanback 细节屏幕的包装器片断。PlaybackOverlayFragment
- 用于显示播放控件及相关内容的 DetailsFragment
子类。SearchFragment
- 用于处理搜索的片断。片断能够接收用户的搜索请求并将其传递给应用提供的 SearchResultProvider
。SearchResultProvider
能够将搜索结果返回给 SearchFragment
,后者会将结果渲染到 RowsFragment
中。此库的 Gradle 构建脚本依赖关系标识符以下所示:
com.android.support:leanback-v17:24.2.0
注解软件包提供的 API 支持向应用中添加注解元数据。
此库的 Gradle 构建脚本依赖关系标识符以下所示:
com.android.support:support-annotations:24.2.0
设计软件包提供的 API 支持向应用中添加 Material Design 组件和模式。
设计支持库添加了对应用开发者依赖的各类 Material Design 组件和模式的支持,例如抽屉式导航栏、浮动操做按钮 (FAB)、快捷信息栏和标签页。
此库的 Gradle 构建脚本依赖关系标识符以下所示:
com.android.support:design:24.2.0
自定义标签页软件包提供的 API 支持向应用中添加自定义标签页并对其进行管理。
自定义标签页支持库添加了对自定义标签页服务和自定义标签页回调等各类类的支持。
此库的 Gradle 构建脚本依赖关系标识符以下所示:
com.android.support:customtabs:24.2.0
百分比软件包提供的 API 支持向应用中添加基于百分比的尺寸并对其进行管理。
百分比支持库添加了对 PercentLayoutHelper.PercentLayoutParams 接口和各类类的支持,例如 PercentFrameLayout 和 PercentRelativeLayout。
此库的 Gradle 构建脚本依赖关系标识符以下所示:
com.android.support:percent:24.2.0
应用建议软件包提供的 API 支持向电视设备上运行的应用中添加内容建议。
应用库添加了对注解(例如 ContentRecommendation.ContentMaturity 和各类类(例如 ContentRecommendation 和 RecommendationExtender)的支持。
此库的 Gradle 构建脚本依赖关系标识符以下所示:
com.android.support:recommendation:24.2.0
This page provides details about the most recent Support Library package releases. For earlier releases, see the Support Library Revisions Archive.
EmojiEditTextHelper
throws NullPointerException
.IllegalStateException
: Fragment has not been attached yet.MediaMetadataCompat
throws BadParcelableException
.startActivityForResult()
is called. (Issue 65665621)RecyclerView
. (AOSP issue 66996774)Fragment
can use support library versions of Transition
for fragment transitions, including shared-element transitions.android.support.content.ContentPager
) provides support for paging content exposed via a ContentProvider
. Use of this library allows a client to avoid expensive interprocess "cursor window swaps" on the UI thread, providing a compatibility library for the Android 8.0 feature.ViewCompat
now adds wrappers for autofill methods, including getImportantForAutofill()
, isImportantForAutofill()
, setAutofillHints()
, andsetImportantForAutofill()
.Picker
now can use different separators between each column using the setSeparators()
method.DiffCallback
has been added to allow ArrayObjectAdapter
to take advantage of the output provided by DiffUtil
.MediaControllerGlue
, PlaybackControlGlue, PlaybackControlSupportGlue
, and PlaybackOverlayFragment
.PermissionCompatDelegate
.android.support.v7.NotificationCompat
(use v4 NotificationCompat
instead), KeyEventCompat
, ParallelExecutorCompat
, and SearchViewCompat
.android.support.wear.utils.MetadataConstants
.AmbientMode
reference.RoundedDrawable
now supports XML inflation.This is a special release to integrate the Support Library with Lifecycles from Architecture Components. If you are not using the Lifecycles library, you don’t need to update from 26.0.2. For more information, see the Architecture Components release notes.
Fragment
and FragmentActivity
(the base class for AppCompatActivity
) now implement the LifecycleOwner
interface from Architecture Components.GuidedAction.multilineDescription
doesn't work properly with LeanbackImportant: The support libraries are now available through Google's Maven repository. You do not need to download the support repository from the SDK Manager. For more information, see Support Library Setup.
ConstraintLayout
widget, which is provided as a separate artifact in SDK Manager.android.support.v7.app.NotificationCompat
and its containing classes has been deprecated and will be removed in a future release:
NotificationCompat.Builder
instead of v7.app.NotificationCompat.Builder
. Functionality that previously relied on using the v7 AppCompat Builder has now been folded into the v4 Compat Builder.DecoratedCustomViewStyle
has moved to the android.support.v4.app
package.MediaStyle
and DecoratedMediaCustomViewStyle
are now part of the media-compat library and can be found in the android.support.v4.media.app package.fastScrollEnabled
boolean flag for RecyclerView
. If enabled, fastScrollHorizontalThumbDrawable
, fastScrollHorizontalTrackDrawable
,fastScrollVerticalThumbDrawable
, and fastScrollVerticalTrackDrawable
must be set.Please note that 26.0.0-beta2 is a pre-release version. Its API surface is subject to change, and it does not necessarily include features or bug fixes from the latest stable versions of Support Library.
Important: The support libraries are now available through Google's Maven repository. You do not need to download the support repository from the SDK Manager. For more information, see Support Library Setup.
JobIntentService
class, to help developers schedule tasks in a way that complies with the new Android O background execution limits.Please note that 26.0.0-beta1 is a pre-release version. Its API surface is subject to change, and it does not necessarily include features or bug fixes from the latest stable versions of Support Library.
Important: The support libraries are now available through Google's Maven repository. You do not need to download the support repository from the SDK Manager. For more information, see Support Library Setup.
FragmentActivity.setSupportMediaController()
and FragmentActivity.getSupportMediaController()
have been removed. Please use the new static MediaControllerCompat.setMediaController()
and MediaControllerCompat.getMediaController()
methods.BottomNavigationView
now calls onNavigationItemReselected()
when an already-selected item is selected, rather than callingonNavigationItemSelected()
.findViewById()
method now return <T extends View> T
instead of View
. This change has the following implications:
someMethod(View)
and someMethod(TextView)
that takes the result of a call to findViewById()
.View
when the return type is unconstrained (for example,assertNotNull(findViewById(...)).someViewMethod())
.findViewById()
methods (for example, Activity.findViewById()
) will need their return type updated.FragmentManager
and Fragment
have an isStateSaved()
method to allow querying whether or not a transaction will be allowed without state loss. This is especially useful to check when handling an onClick()
event before executing any transaction.AnimatedVectorDrawableCompat
. Path motion allows one object animator to change two properties at the same time based on one path; the path is specified as android:pathData
in the animator’s XML).FlingAnimation
that supports animating with an initial velocity and smoothly slows down.DynamicAnimation
support animating custom property for any object.SpringAnimation
and FlingAnimation
can now animate a float value without requiring a View
or an Object
to be associated with it.For more information, see the Spring animation and Fling animation preview pages.
ResourcesCompat.getFont
allows loading font resources—including font-family XML—that may be used with TextView.setTypeface()
.android:fontFamily
XML attribute.app:
attributes as well as the android:
attributes.)FontsContractCompat
that allows you to request fonts from a font provider instead of bundling them in your app.EmojiCompat
can process a given CharSequence
and add EmojiSpans
.EmojiTextView
and other widgets to display emoji.FontRequestEmojiCompatConfig
to request emoji font from a font provider.TextViewCompat
as well as XML attributes to control autosizing in TextView
.PlaybackTransportRowPresenter
that renders playback controls with a SeekBar.PlaybackTransportControlGlue
that works with PlaybackTransportRowPresenter
and supports seek.PlaybackSeekDataProvider
for app to provide seek thumbnails to PlaybackTransportControlGlue
.PreferenceDataStore
now allows you to implement your own preferences storage, set with new methods in Preference
and PreferenceManager
.MediaBrowserCompat.search()
API does not work (AOSP issue 262170)ViewCompat.postInvalidateOnAnimation()
throws exception (AOSP issue 80146)onActivityCreated()
called for fragments in destroyed ActivityRecyclerView.isComputingLayout()
should return true during prefetchFade
transition is interrupted and reversed, the View
starts the animation from the beginning. (Fix ported from Android Framework.)Transition.Fade
ignores initial alpha of View
(AOSP issue 221820)Please note that 26.0.0-alpha1 is a pre-release version. Its API surface is subject to change, and it does not necessarily include features or bug fixes from the latest stable versions of Support Library.
Note: The minimum SDK version has been increased to 14. As a result, many APIs that existed only for API < 14 compatibility have been deprecated. Clients of these APIs should migrate to their framework equivalents as noted in the reference page for each deprecated API.
Many new classes, methods, and constants added to provide backwards-compatible support for platform APIs added in O Preview.
IME_FLAG_NO_PERSONALIZED_LEARNING
: IMEs can listen for "no learning" flags for apps that have a private mode, such as browsers. This feature helps IMEs understand if an app is in a private mode, so they can disable their learning or adaptive functionality while the app is in that mode.For a complete list of API changes between 25.2.0 and 26.0.0-alpha1, see the support library API differences report.
AutoTransition
animation can be interrupted by view "jumps". (AOSP issue 221816)
This page provides details about older Support Library package releases. For the most recent Support Library releases, see Recent Support Library Revisions.
Important: The support libraries are now available through Google's Maven repository. You do not need to download the support repository from the SDK Manager. For more information, see Support Library Setup.
executePendingTransactions()
, commitNow()
, popBackStackImmediate()
, and similar transaction calls are not allowed during FragmentManager
state changes. Reentrant execution of transactions are unsafe and FragmentManager
now enforces this during its state changes.Path morphing and path interpolation are supported in AnimatedVectorDrawableCompat
. Path morphing allow the shapes changing from one path (specified as android:valueFrom
) to another path (specified asandroid:valueTo
), in order to provide complex and attractive visual effects. Path interpolation allows the interpolators for AnimatedVectorDrawableCompat
to be specified as paths (specified as android:pathData
in the interpolator’s XML).
SwitchCompat
requires minimum SDK version of 14 or higher. (AOSP issue 251302)updateListener
skips the first frame.BottomNavigationView
label animation is broken.Support Library version metadata will automatically be added to AndroidManifest.xml
when building from Gradle, which simplifies tracking versions in public builds. For example:
<meta-data android:name="android.support.VERSION" android:value="25.3.0" />
A number of methods and classes have been deprecated in this release. These deprecated APIs will be removed in a future version and developers should migrate away from them. For more information on how to migrate away from a specific API, refer to its documentation.
ExifInterface
getLatLong(float[])
is deprecated. Instead, use the new method
getLatLong()
, which takes no arguments and returns
double[]
.
mediacompat
PlaybackStateCompat.Builder.setErrorMessage(CharSequence)
is deprecated. Instead, use the new method
setErrorMessage(int, CharSequence)
, which is passed an error code and an optional description.
EXTRA_SUGGESTION_KEYWORDS
is deprecated. Instead, use the
MediaBrowserCompat
search functionality.
v7.recyclerview
LinearLayoutManager.getInitialItemPrefetchCount()
has been renamed to
LinearLayoutManager.getInitialPrefetchItemCount()
. The old name is still supported but will be removed in a future release.
appcompat-v7
ActionBarDrawerToggle.setDrawerSlideAnimationEnabled(boolean)
simplifies disabling the navigation drawer toggle icon's animation.
customtabs
CustomTabsService.requestPostMessageChannel()
and
CustomTabsService.postMessage()
reference for details.
dynamic-animation
leanback-v17
Parallax
reference for details.
TimePicker
widget for picking times on a TV interface.
mediacompat
MediaBrowserCompat.search()
and
MediaBrowserServiceCompat.onSearch()
reference for details.
MediaSessionCompat.setRepeatMode()
and
setShuffleModeEnabled()
reference for details.
StaggeredGridLayoutManager
throws IllegalArgumentException
(AOSP issue 230295)RecyclerView
prefetch does not properly handle a RecyclerView
that is attached but not onscreenLinearLayout
not recognized by RobolectricActivity
is destroyed, onActivityCreated()
is improperly called for its fragmentsAppCompatImageView
constructor causes ArrayIndexOutOfBoundsException
Call.Details
activity transitionFragmentManager.FragmentLifecycleCallbacks
class is now static.setMediaButtonReceiver()
VectorDrawable
error with string resource (AOSP issue 232407)TextInputLayout
overlays hint and text if text is set by XML (AOSP issue 230171)MediaControllerCompat
(AOSP issue 231441)RecyclerViewLayoutTest.triggerFocusSearchInOnRecycledCallback()
crashingRecyclerView
crashes when recycling view holders (AOSP issue 225762)getAllowGeneratedReplies()
incorrectly returns false for actions inside a WearableExtender
Important: There is a known bug in the android.support.v7.media.MediaRouter
class in revision 25.1.1 and 25.1.0 of the Support Library. If your app uses the v7 MediaRouter
, you should update to Support Library Revision 25.2.0, which fixes this bug.
Fragment transactions can now be optimized within and across transactions. Optimizing fragment transaction operations can eliminate operations that cancel. For example, suppose two transactions are executed together, one that adds a fragment A and a second one that replaces fragment A with fragment B. In this case, the first operation might be canceled, and only fragment B added. That means that fragment A might not go through the creation/destruction lifecycle.
A side effect of this optimization is that fragments might have state changes out of the expected order. For example, suppose one transaction adds fragment A, a second adds fragment B, then a third removes fragment A. Without optimization, fragment B could expect that while it is being created, fragment A will also exist because fragment A will be removed after fragment B is added. With optimization, fragment B cannot be sure that fragment A will exist while B is being created, because fragment A's creation and destruction may be removed by the optimization.
This optimization is disabled by default. To enable the optimization, call FragmentTransaction.setAllowOptimization(true)
.
Fragment.postponeEnterTransition()
and Fragment.startPostponedEnterTransition()
. This API is similar to Activity.postponeEnterTransition()
and Activity.startPostponedEnterTransition()
used with Activity Transitions.MediaSessionCompatTest
fails with IllegalArgumentException
DetailsFragment.installTitleView()
is not called in 25.1.0BottomNavigationView
needs spacing between item icon and text (AOSP issue 230653)PlaybackFragment
and PlaybackSupportFragment
TextInputLayout
focus does not change properly in emulator from support library version 25.1.0 (AOSP issue 230461)BottomNavigationView
(AOSP issue 230343)RecyclerView
with StaggeredGridLayoutManager
crashes with full-span items (AOSP issue 230295)MediaSessionCompat
when using setCallback(null)
PlaybackGlueHostOld
and PlaybackSupportGlueHostOld
don't notify callbacks when playback row changesPlaybackOverlayFragment
example /test
can not start playingRecyclerViewFocusRecoveryTest
is failing on API 15RecyclerViewLayoutTest.triggerFocusSearchInOnRecycledCallback()
crashes on API 15setActions()
in onSubactionClicked()
is brokenRecyclerView
crashes when recycling some view holdersImportant: There is a known bug in the android.support.v7.media.MediaRouter
class in revision 25.1.1 and 25.1.0 of the Support Library. If your app uses the v7 MediaRouter
, you should update to Support Library Revision 25.2.0, which fixes this bug.
RecyclerView
widgets (for example, vertical scrolling list of horizontal scrolling lists) can get significant performance benefits by hinting the inner RecyclerView
widgets’ layout managers how many items to prepare before being scrolled on screen. CallLinearLayoutManager.setInitialPrefetchItemCount(N)
, where N is the number of views visible per inner item. For example, if your inner, horizontal lists show a minimum of three and a half item views at a time, you can improve performance by callingLinearLayoutManager.setInitialPrefetchItemCount(4)
. Doing so allows RecyclerView
to create all relevant views early, while the outer RecyclerView
is scrolling, which significantly reduces the amount of stuttering during scrolls.FragmentActivity.setSupportMediaController()
and FragmentActivity.getSupportMediaController()
have been deprecated. Please use the new static MediaControllerCompat.setMediaController()
and MediaControllerCompat.getMediaController()
methods.appcompat:buttonTint
), the client is responsible for providing all necessary states (such as "disabled", "pressed", etc.). This is consistent with how widget tints are specified when using framework tinting.Snackbar
has been refactored to allow apps to display custom content. BaseTransientBottomBar
is the new base class that exposes the general sliding and animations behavior.SeekBarPreference
with customizable layout and attributes to the v7 preference support library.ArraySet
class to the v4 support library. This class corresponds to the framework ArraySet
class that was introduced with API level 23.RecyclerView
RecyclerView item prefetching improvements:
RecyclerView
prefetch enables prefetching of content from a RecyclerView
within another scrolling RecyclerView
, with API to control how much prefetching is done:
LayoutManager
objects to implement to enable prefetching during scrolls and flings
state_enabled
on pre-L devices.RecyclerView
. This also fixed support pref fragments broken focus when using DPAD navigation such as on Android TV devices.AlertDialog
is too wide.InputContentInfoCompat
calls requestPermission()
when it should call releasePermission()
.MediaBrowserCompat
crashes.GONE
.AnimatedVectorDrawableCompat
on API level below 24RecyclerView
failed tests on LeanbackRecyclerView
crashes when recycling view holders (AOSP issue 225762)Fragment.onDestroy()
not called for fragment in backstackCollapsingToolbarLayout
scrim is not drawn when collapsedCoordinatorLayout.offsetChildByInset()
throws IllegalArgumentException
RecyclerView
items detach inner RecyclerView
s, prevent future prefetchesRecyclerView
items can't be nested-prefetchedRecyclerView
items is discarded during first layoutRecyclerView
prefetch fails if two drag events arrive at same positionRecyclerView
should speculatively layout while RenderThread is renderingFloatingActionButton
: Programmatically setting BackgroundTintList does not work properly (AOSP issue 227428)TextInputLayout
: Typeface is not getting set for ErrorView (AOSP issue 227803)TextInputLayout
always falls back to light error color below API 23 (AOSP issue 221992)FloatingActionButton
shows as pressed when pointer leavesA complete list of public bug fixes is available on the AOSP Issue Tracker.
A number of methods and classes have been deprecated in this release. These deprecated APIs will be removed in a future version and developers should migrate away from them. For more information on how to migrate away from a specific API, refer to its documentation.
android.support.design.widget
android.support.v17.leanback.app
BackgroundManager.getDefaultDimLayer()
BackgroundManager.getDimLayer()
BackgroundManager.setDimLayer()
MediaControllerGlue.MediaControllerGlue(Context,PlaybackOverlayFragment,int[])
MediaControllerGlue.MediaControllerGlue(Context,PlaybackOverlayFragment,int[],int[])
PlaybackControlGlue.PlaybackControlGlue(Context,PlaybackOverlayFragment,int[])
PlaybackControlGlue.PlaybackControlGlue(Context,PlaybackOverlayFragment,int[],int[])
PlaybackControlGlue.getFragment()
PlaybackControlGlue.getOnItemViewClickedListener()
PlaybackControlGlue.onRowChanged()
PlaybackControlGlue.pausePlayback()
PlaybackControlGlue.skipToNext()
PlaybackControlGlue.skipToPrevious()
PlaybackControlGlue.startPlayback()
PlaybackControlSupportGlue
PlaybackOverlayFragment
PlaybackOverlaySupportFragment
android.support.v17.leanback.widget
android.support.v4.app
FragmentActivity.getSupportMediaController()
FragmentActivity.setSupportMediaController()
TextInputLayout
password toggle is now disabled by default to avoid unnecessarily overwriting developer-specified end drawables. It may be manually enabled via the passwordToggleEnabled
XML attribute.BottomNavigationView
items are now single line to match Material spec.RecyclerView
crashes during prefetch if layout manager is null.BottomNavigationView
elevation is now set properly. (AOSP issue 226182)BottomNavigationView
crashing when adding menu items programmatically. (AOSP issue 225731)TextInputLayout
left+right compound drawables. (AOSP issue 225836)RecyclerView
crashes when recycling view holders. (AOSP issue 225762)RecyclerView
: Rendering problems in Android Studio. (AOSP issue 225753)BottomNavigationView
still shows menu item as selected after onNavigationItemSelected()
returns false. (AOSP issue 225898)NoSuchMethodError
. (AOSP issue 225647)TextInputEditText
does not show hints in IME extract mode. (AOSP issue 221880)A complete list of public bug fixes is available on the AOSP Issue Tracker.
ContextCompat
constructor has been made protected. This class should not be publicly instantiated, but it may be extended by support libraries targeting newer API levels.ActivityCompat
constructor has been made protected. This class should not be publicly instantiated, but it may be extended by support libraries targeting newer API levels.getReferrer(Activity)
has been made static.android.support.design.widget.CoordinatorLayout.Behavior.isDirty(CoordinatorLayout, V)
has been removed. Any client implementations of this method should be removed.android.support.v4.media.session.MediaSessionCompat.obtain(Context, Object)
has been removed. Usages should be replaced with the more appropriately named method fromMediaSession()
.android.support.v4.media.session.MediaSessionCompat.QueueItem.obtain(Object)
has been removed. Usages should be replaced with the more appropriately named method MediaSessionCompat.QueueItem#fromQueueItem
.android.support.v7.widget.Space
has been removed. Usages should be replaced with android.support.v4.widget.Space
.android.support.design.widget.BottomNavigationView
class implements the bottom navigation pattern from the Material Design spec.android.support.v13.view.inputmethod
package includes classes for accessing android.view.inputmethod.InputConnection
features introduced after API level 13.android.v7.widget.RecyclerView.DividerItemDecoration
class provides a base implementation for vertical or horizontal dividers between items.android.support.v7.app.NotificationCompat
, DecoratedCustomViewStyle
and DecoratedMediaCustomViewStyle
, mirror classes added in platform API 24.A complete list of public bug fixes is available on the AOSP Issue Tracker.
Fixed issues:
FloatingActionButton
can no longer be anchored to indirect children of CoordinatorLayout
. (AOSP issue 220250)CollapsingToolbarLayout
doesn’t scale properly with fitsSystemWindows=true
. (AOSP issue 220389)CoordinatorLayout
throws IndexOutOfBoundsException
when Snackbar
is shown and dismissed. (AOSP issue 220762)TextInputLayout
fails to resolve error text color. (AOSP issue 220305)BatchedCallback.onMoved()
calls BatchedCallback.onInserted()
. (AOSP issue 220309)TextInputLayout
overrides right compound drawable. (AOSP issue 220728)A complete list of public bug fixes is available on the AOSP Issue Tracker.
Release 24.2.0 contains the following changes:
Note: Release 24.2.0 removes support for Android 2.2 (API level 8) and lower. Classes and methods that exist only to serve those system versions are now marked as deprecated and should no longer be used. These deprecated classes and methods may be removed in a future release.
With this release, the v4 Support Library has been split into several smaller modules:
support-compat
Context.getDrawable()
and
View.performAccessibilityAction()
.
support-core-utils
AsyncTaskLoader
and
PermissionChecker
.
support-core-ui
ViewPager
,
NestedScrollView
, and
ExploreByTouchHelper
.
support-media-compat
MediaBrowser
and
MediaSession
.
support-fragment
support-compat
,
support-core-utils
,
support-core-ui
, and
support-media-compat
.
For backwards compatibility, if you list support-v4
in your Gradle script, your APK will include all of these modules. However, to reduce APK size, we recommend that you just list the specific modules your app needs.
CustomTabsIntent.Builder.setInstantAppsEnabled()
or specify EXTRA_ENABLE_INSTANT_APPS
. By default, Custom Tabs will default to enabling Instant Apps, when that feature becomes available.TextInputLayout
adds support for the password visibility toggle from the material design specification.android.support.transition
package backports the Transitions framework to API levels 14 and higher. For more information, see the android.support.transition
reference.RemoteViews
in the secondary toolbar. The existing setToolbarItem()
method is now deprecated.AppCompatResources
adds the ability to load a <vector>
(on API level 9 and higher) or <animated-vector>
(on API level 11 and higher) from a resource ID, by using the new getDrawable()
method.CoordinatorLayout
now supports defining inset views, and specifying that other views should dodge the inset views. This allows apps to replicate behavior patterns similar to the way FloatingActionButton
moves out of the way of a Snackbar
, but for any arbitrary view children. For more information, see the LayoutParams.insetEdge
and LayoutParams.dodgeInsetEdges
reference documentation.DiffUtil
class can calculate the difference between two collections, and can dispatch a list of update operations that are suitable to be consumed by a RecyclerView.Adapter
.RecyclerView.OnFlingListener
has been added to support custom behavior in response to flings. The SnapHelper
class provides an implementation specifically for snapping child views, and the LinearSnapHelper
class extends this implementation to provide center-aligned snapping behavior similar to ViewPager
.CustomTabsIntent.setAlwaysUseBrowserUI()
. This behavior is useful in cases where the browser defaults to custom tabs UI but the user has expressed a preference for the standard browser UI.AppCompatDelegate.setLocalNightMode()
).Snackbar
now draws behind the navigation bar if the status bar is translucent.Bluetooth devices are no longer listed as media routes. Routing audio to Bluetooth devices is now solely controlled at the Android system level.
Deprecated classes and methods are subject to removal in a future release. You should migrate away from these APIs as soon as possible.
android.support.v4.view.KeyEventCompat
: Replace with KeyEvent
android.support.v4.view.MotionEventCompat
: Use MotionEvent
android.support.v4.view.ViewCompat
: Use View
android.support.v4.view.ViewConfigurationCompat
: Use ViewConfiguration
AccessibilityServiceInfoCompat.getDescription()
has been deprecated in favor of AccessibilityServiceInfoCompat.loadDescription()
, which returns a correctly localized description.ActivityCompat
class directly. The non-static getReferrer(Activity)
method will be made static in an upcoming release.CoordinatorLayout.Behavior.isDirty()
has been deprecated and is no longer called by CoordinatorLayout
. Any implementations, as well as any calls to this method, should be removed.MediaSessionCompat.obtain()
has been deprecated and replaced with the more appropriately-named method fromMediaSession()
.MediaSessionCompat.QueueItem.obtain()
has been deprecated and replaced with the more appropriately-named method fromQueueItem()
.AccessibilityStateChangeListenerCompat
has been replaced by the AccessibilityManagerCompat.AccessibilityStateChangeListener
interface.OnCloseListenerCompat
has been replaced by the SearchViewCompat.OnCloseListener
interface.OnQueryTextListenerCompat
has been replaced by the SearchViewCompat.OnQueryTextListener
interface.CustomTabsSession.setToolbarItem()
has been deprecated and replaced by the RemoteViews-based setSecondaryToolbarViews()
.The following known issues have been fixed with release 24.2.0:
SwipeRefreshLayout
indicator is shown when setRefreshing(true)
is called before the first measurement pass (AOSP issue 77712)TabLayout
from flickering when changing pages (AOSP issue 180454)ClassNotFoundException
when unmarshalling SavedState
on API level 11 and lower (AOSP issue 196430)A complete list of public bug fixes is available on the AOSP Issue Tracker.
Fixed issues:
NotificationCompat.Action.WearableExtender
has new getHintDisplayActionInline()
and setHintDisplayActionInline()
methods for compatibility with Android Wear 2.0 Preview. These methods allow an application to specify that an action should be displayed inline with the notification.Fragment.setUserVisbileHint()
will no longer cause a fragment to become started if the hint has been added to a FragmentTransaction
that is not yet committed. This affects users of FragmentPagerAdapter
that override setUserVisbileHint()
and assume a specific lifecycle state of the fragment after calling super.setUserVisibleHint()
. For more information, see the reference page for docs for Fragment.setUserVisbileHint()
.Fixed issues:
Fragment.commitNow()
for synchronous commitNotificationCompat.MessagingStyle
for multi-party conversationsNotificationManagerCompat.areNotificationsEnabled()
and getImportance()
MediaSessionCompat
now mirrors the functionality of MediaSession
and no longer calls setMediaButtonReceiver()
automaticallyNote: Only MediaBrowserServiceCompat
in version 24.0.0 is forward-compatible with future versions of Android beyond API 24. If you are using previous versions, update to this version to ensure compatibility.
ColorStateList
objects from XMLAppBarLayout
handling of elevation using StateListAnimator
OnboardingFragment
to provide first-run welcome and setup flowRemoteViews
hierarchy for the secondary toolbarCustomTabsClient.connectAndInitialize()
for one-line warm upAppCompatDelegate.setCompatVectorFromResourcesEnabled()
method to re-enable usage of vector drawables in DrawableContainer
objects on devices running Android 4.4 (API level 19) and lower. See AppCompat v23.2 — Age of the vectors for more information.AppCompatDelegate.setDefaultNightMode()
not loading correct resources in API level 23. (Issue 206573)NullPointerException
. (Issue 207638)TextInputLayout
doesn't clear error tint after setErrorEnabled(false)
on API level 21 - 22 (Issue 202829)FloatingActionButton
does not return when animations are disabled. (Issue 206416)AppBarLayout
snap functionality when used with scroll
|enterAlways
|enterAlwaysCollapsed
|snap
scroll flags. (Issue 207398)VectorDrawableCompat
does not render correctly in TextView
on API level 23. (Issue 206227)AppLaunchChecker
to help track how your app has been launched by the user in the past. hasStartedFromLauncher()
lets you know if the user has launched your app from the home screen before, or if it has only been started by other means (for example, to view specific web URLs).MediaBrowserServiceCompat.mConnections
. (Issue 205220)ViewPager
does not account for page margins when flipping page. (Issue 203816)Fragment.onRequestPermissionsResult()
is now delivered to child fragments.AppCompatSpinner
that could cause multiple popups to appear. (Issue 205052)AppCompatDialogFragment
and AlertDialog
. (Issue 204805)TintResources
that were causing memory and configuration issues. (Issue 205236)MediaRouteControllerDialog
volume slider’s behavior. (Issue 202299)PreferenceFragmentCompat
would crash if dividerHeight
is specified. (Issue 204778)RecyclerView
would not invoke scroll callbacks if the range of visible items shrank. (Issue 200987)RecyclerView
would freeze if it was in linear layout, was weighted, and contained images. (Issue 203276)OrientationHelper.getStartAfterPadding()
. (Issue 180521)android:nestedScrollingEnabled
. (Issue 197932)BottomSheetBehavior
when fitsSystemWindows
is true. (Issue 203057)Snackbar
. (Issue 182145)Snackbar
swipe. (Issue 203924)AppBarLayout
with enterAlways
. (Issue 203661)TextInputLayout
unnecessarily clears EditText
object's background color filter. (Issue 203357)DrawableCompat.wrap()
and LayerDrawable
on API levels 17 to 19. (Issue 201817)ArrayIndexOutOfBoundsException
in ViewDragHelper.shouldInterceptTouchEvent()
. (Issue 182262)ViewPager
related to scroll calculation for size changes.NullPointerException
when DrawerLayout.removeDrawerListener()
is called without a set DrawerLayout.DrawerListener
. (Issue 202478)ViewPager
does not set AccessibilityEvent
parameters properly when scrolling.Drawable.wrap()
. (Issue 201924)VectorDrawable
and its associated build flags.SwitchCompat
and API level 7. (Issue 201942)android.support.v7.app.NotificationCompat.MediaStyle
cancel button becomes invisible on API level 21 and below. (Issue 202156)AppCompatSpinner
on API level 21 and below. (Issue 202246)app:textAllCaps = "false"
style did not work. (Issue 202117)SearchView
. (Issue 201836)KeyEvent
on API level 11 and lower. (Issue 202939)CardView
. (Issue 194497)RecyclerView
does not allow adapter changes while calculating a layout or scroll. (Issue 202046)notifyItemChanged()
on an item that is out of view. (Issue 202136)RecyclerView.LayoutManager
adds and removes a view in the same measurement pass. (Issue 193958)MediaRouter.getInstance()
on API level 17. (Issue 180654)GridLayout.onAddFocusables()
that caused the wrong item to be selected.GuidedStepFragment
actions disappearing after an action was collapsed.TabLayout
crash caused by tab-pooling. (Issue 201827)NavigationView
that caused the wrong color to be selected. (Issue 201951)setBackgroundTintList()
was no longer able to change the background color. (Issue 201873)AppBarLayout
did not completely scroll out of view when used with android:fitsSystemWindows = “true”
. (Issue 201822)BottomSheetDialog
did not display short content views correctly. (Issue 201793)BottomSheetDialogFragment
moved sporadically when content inside was changed. (Issue 202125)TextInputLayout.getCounterMaxLength()
restored a saved state. (Issue 202375)ClassCastException
that occurred when restoring a CoordinatorLayout
using the saved state of a view that was not a CoordinatorLayout
.android:tintMode
. (Issue 201907)MediaBrowserCompat
for MediaBrowser
support, and MediaBrowserServiceCompat
for MediaBrowserService
support. This is useful when connecting a media app’s background service with UI components, and integrating with Android Auto and Android Wear without requiring API level 21 or higher.onActivityResult()
for a nested FragmentActivity
.<sdk>/extras/android/support/v7/appcompat/res/values/themes_daynight.xml
AppCompatDelegate.setDefaultNightMode()
: sets the app’s default mode by passing one of the following constants:MODE_NIGHT_AUTO
MODE_NIGHT_NO
MODE_NIGHT_YES
MODE_NIGHT_FOLLOW_SYSTEM
AppCompatDelegate.setLocalNightMode()
: overrides the night mode setting for the local app component.AppCompatDelegate.getDefaultNightMode()
: returns the default night mode.MediaRouteControllerDialog
now correctly applies custom app theme colors.BottomSheetBehavior
, allows a child view of a CoordinatorLayout
to act as a bottom sheet. The base class, BottomSheetCallback
, provides callbacks to monitor bottom sheet events.CustomTabsIntent.Builder.addToolBarItem()
: adds an action button to a custom tab. You can use this to add multiple buttons.CustomTabsSession.setToolBarItem()
: updates the visuals for toolbar items. This method will only succeed if it is given a valid id and the browser session is in the foreground.VectorDrawableCompat
AnimatedVectorDrawableCompat
VectorDrawable
assets to apps running on API level 7 or higher. AnimatedVectorDrawable
assets are also supported on API level 11 or higher. Vector assets can be considerably smaller than image assets and should help reduce app size by reducing the amount of assets required to support multiple device screens.VectorDrawableCompat
within an ImageButton
or ImageView
, use the app:srcCompat
XML attribute or setImageResource()
method.appt
flag to your build,gradle
file:build.gradle
file:android {
defaultConfig {
// Stops the Gradle’s automatic rasterization of vectors
generatedDensities = []
}
// Flag that tells aapt to keep the attribute ids
aaptOptions {
additionalParameters "--no-version-vectors"
}
}
build.gradle
file:android {
defaultConfig {
vectorDrawables.useSupportLibrary = true
}
}
GuidedStepFragment
, which is a component that guides users through a decision or series of decisions:GuidedAction
:GuidedStepFragment.setButtonActions()
: sets a list of GuidedAction
buttons that the user may select from the Actions view.GuidedAction.Builder.descriptionEditable()
: when passing true
, sets the action’s description to be editable.GuidedAction.getEditDescription()
: returns the editable description as a CharSequence
.GuidedAction.setSubActions()
: sets a GuidedAction
list as a drop-down menu of sub-actions.GuidedDatePickerAction
widget for DatePicker
functionality:GuidedDatePickerAction.Builder
: builder class for the GuidedDatePickerAction
object.GuidedDatePickerAction.Builder.datePickerFormat(String datePickerFormat)
: set the desired date format by passing the appropriate three-character String
, e.g. “YMD”
or “MDY”
. Alternatively, use the datePickerFormat
XML attribute.RecyclerView
now has an opt-in feature called AutoMeasure which allows RecyclerView.LayoutManager
to easily wrap content or handle various measurement specifications provided by the parent of the RecyclerView
. It supports all existing animation capabilities of the RecyclerView
.RecyclerView.LayoutManager
, call setAutoMeasureEnabled(true)
to start using the new AutoMeasure API. All built-in RecyclerView.LayoutManager
objects enable auto-measure by default.RecyclerView.LayoutManager
no longer ignores some RecyclerView.LayoutParams
settings, such as MATCH_PARENT
in the scroll direction. Note: These lifted restrictions may cause unexpected behavior in your layouts. Make sure you specify the correct layout parameters.
RecyclerView.ViewHolder
with payload information, DefaultItemAnimator
now disables change animations.ItemTouchHelper
escape velocity to control swipe sensitivity. To make it easier or harder to swipe, override getSwipeEscapeVelocity(float defaultValue)
and modify defaultValue
.ItemTouchHelper
utility class provides, and then add an item. (Issue 190500)getHeaderView
method to the NavigationView
class.FloatingActionButton
object on devices running Android 4.0 (API level 15) and lower. (Issue 183315)OnScrollChangedListener
interface support to the NestedScrollView
widget. It allows you to receive callbacks when the scroll X or Y positions change.MediaButtonReceiver
class to forward received playback controls to a service that’s managing the MediaSessionCompat
class. TheMediaSessionCompat
class has a constructor that can automatically find a media button receiver in the manifest. A media button receiver is a key part to handling playback controls from hardware or bluetooth controls.Seekbar
and ImageButton
widgets.ImageView
widget to support the tint feature.SwitchCompat
widget.MediaRouteChooserDialog
class:MediaRouteControllerDialog
class:setRegion()
method to support extracting color from a specific region of a Bitmap
object.ItemAnimator
class for better customizations:ViewHolder
object, which enables item content animations. Also, the ItemAnimator
object decides whether it wants to reuse the same ViewHolder
object or create a new one.ItemAnimator
class the flexibility to collect data at the correct point in the layout lifecycle. This information is later passed into the animate callbacks.ItemAnimator
class, you can change your base class to SimpleItemAnimator
and your code should work as before. The SimpleItemAnimator
class provides the old API by wrapping the new API.ItemAnimator
class. The following code will no longer compile:recyclerView.getItemAnimator().setSupportsChangeAnimations(false)
You can replace it with:
ItemAnimator animator = recyclerView.getItemAnimator();
if (animator instanceof SimpleItemAnimator) {
((SimpleItemAnimator) animator).setSupportsChangeAnimations(false);
}
EditText
dialogs.GuidedStepFragment
class for the Support library (extends android.support.v4.app.Fragment
), and improved animations and transitions.GuidedStepFragment
class so it can be placed on top of existing content.SearchFragment
class.VerticalGridFragment
class.TextInputLayout
widget.AppBarLayout
class by adding the SCROLL_FLAG_SNAP
constant. When scrolling ends, if the view is only partially visible, the view is snapped and scrolled to its closest edge.NavigationView
class by using the app:actionLayout
attribute or MenuItemCompat.setActionView()
method.enableUrlBarHiding()
method to the CustomTabsIntent
class. It lets the client customize whether the URL bar should be hidden automatically on scroll down.setActionButton()
method to the CustomTabsSession
class. It lets the client change the icon for a custom action button in an already launched custom tab.TAB_SHOWN
and TAB_HIDDEN
constants as new events for the onNavigationEvent
method of the CustomTabsCallback
class.Fragment
class by limiting the use of hardware layers to Android 4.1 (API level 16) and higher. (Issue 183896)Toolbar
class to act as the ActionBar
by using the setSupportActionBar()
method. (Issue 183334)AppCompatDialogFragment
class so it no longer throws the Windows feature must be requested before adding content
error. (Issue 183186)AppBarLayout
class so it now draws correctly after rotation. (Issue 183109)TabLayout
class so it now behaves correctly when a user clicks after a swipe. (Issue 183123)minSdkVersion
value from 16 to 15 for version support.CustomTabsSessionToken
from an intent.For a complete list of the Support Library changes, see the Support Library API Differences Report.
hide()
and show()
methods to the FloatingActionButton
class for programmatic triggering of animations.LENGTH_INDEFINITE
constant to the Snackbar
class for showing a snackbar until it is dismissed or another snackbar is shown. Also, added the setActionTextColor(int)
and setActionTextColor(ColorStateList)
methods.getSelectedTabPosition()
method to the TabLayout
class for retrieving the currently selected tab.android.support.v7.app.NotificationCompat.MediaStyle
class for method chaining.RecyclerView
for batch insertion of items.For a complete list of the Support Library changes, see the Support Library API Differences Report.
TextInputLayout
for showing EditText
hint and error text as floating labels.FloatingActionButton
for implementing a primary action on your interface as a floating action button, supporting either default or mini sizes.Snackbar
for providing lightweight feedback with an optional action in an animated snackbar.TabLayout
for implementing fixed and scrollable tabs as well as easy integration with ViewPager
.NavigationView
for implementing navigation drawer contents, including the ability to inflate menu items via a Menu Resource.CoordinatorLayout
, a general purpose layout, used for building dependencies between sibling views and allowing easy scrolling reactions between components via CoordinatorLayout.Behavior
. Many of the Design Library components rely on being a child of aCoordinatorLayout
.AppBarLayout
, a container for a Toolbar
and other views (such as TabLayout
) for reacting to scrolling events by scrolling off the screen, becoming visible in reaction to a downward scroll, or collapsing/uncollapsing before scrolling off/onto the screen.CollapsingToolbarLayout
for controlling how a Toolbar
collapses. A toolbar may collapse by: pinning components to the top of the screen while it collapses, introducing parallax scrolling of components such as an ImageView
, or adding a content scrim color when the view is partially collapsed.getContentChangeTypes()
and setContentChangeTypes()
methods and related change type fields to theAccessibilityEventCompat
class for accessibility event handling.getActiveQueueItemId()
, getCustomActions()
, and getExtras()
methods with related state fields to the PlaybackStateCompat
class for getting custom actions from the queue.addCustomAction()
, setActiveQueueItemId()
, and setExtras()
methods to the PlaybackStateCompat.Builder
class for adding custom actions to a playback state.fromCustomAction()
and getCustomAction()
methods to the PlaybackStateCompat.CustomAction
class for getting custom actions from the queue.isAttachedToWindow()
, offsetLeftAndRight()
, and offsetTopAndBottom()
methods to the ViewCompat
class for working with views.addOnPageChangeListener()
, clearOnPageChangeListeners()
, and removeOnPageChangeListener()
methods to the ViewPager
class for responding to page changes. Deprecated the ViewPager.setOnPageChangeListener()
method.
notifySubtreeAccessibilityStateChanged()
method to the ViewParentCompat
class for notifying a view parent that the accessibility state of one of its descendants has changed.translationZ()
, translationZBy()
, z()
, and zBy()
methods to the ViewPropertyAnimatorCompat
class for adding animation.onWindowStartingSupportActionMode()
method to the AppCompatActivity
, AppCompatCallback
, and AppCompatDialog
classes for handling action modes started from the current window.isHandleNativeActionModesEnabled()
and setHandleNativeActionModesEnabled()
methods to the AppCompatDelegate
class for handling native action modes.For a complete list of the Support Library changes, see the Support Library API Differences Report.
ColorUtils
class to provide a set of color-related utility methods.unwrap()
and wrap()
methods to the DrawableCompat
class , allowing you to use setTint()
, setTintList()
, and setTintMode()
on all API level 4 or higher devices.TraceCompat
class to write trace events to the system trace buffer, which can then be collected and visualized using the Systrace tool.CircularIntArray
class to create circular integer array data structures.clear()
, removeFromStart()
, and removeFromEnd()
methods to the CircularArray
class. Also, changed the existing methods in this class to be non-final.InputDeviceCompat
as a helper class to access data in the InputDeviceCompat
class.LayoutInflaterCompat
class as a helper class to access data in the LayoutInflaterCompat
class and added the LayoutInflaterFactory
interface.NestedScrollingChildHelper
and NestedScrollingParentHelper
helper classes for implementing nested scrolling parent and child views.NestedScrollingChild
interface to be implemented by View
subclasses.NestedScrollingParent
and ScrollingView
interfaces to support scrolling operations and provide scroll related APIs.getNestedScrollAxes()
method to the ViewGroupCompat
class.ViewParentCompat
class to support nested scrolling.NestedScrollView
class to support nested scrolling parent and child on both new and old versions of Android.MotionEventCompat
class for getting axis values and event source.AccessibilityNodeInfoCompat
class to add methods for errors, content invalidation and labels.FastOutLinearInInterpolator
, FastOutSlowInInterpolator
,LinearOutSlowInInterpolator
, LinearOutSlowInInterpolator
, and PathInterpolatorCompat
.Space
class to create gaps between components in general purpose layouts. This class is deprecated in the gridlayout library.TextViewCompat
class for accessing features in a TextView
.onPull()
method in the EdgeEffectCompat
class.AppCompatAutoCompleteTextView
, AppCompatButton
, AppCompatCheckBox
,AppCompatCheckedTextView
, AppCompatEditText
, AppCompatMultiAutoCompleteTextView
, AppCompatRadioButton
, AppCompatRatingBar
,AppCompatSpinner
, and AppCompatTextView
.AppCompatActivity
as the base class for activities that use the support library action bar features. This class replaces the deprecated ActionBarActivity
.AppCompatCallback
interface to be implemented for AppCompat to be able to perform callbacks.AppCompatDelegate
abstract class as a delegate you can use to extend AppCompat's support to any activity.AppCompatDialog
class as the base class for AppCompat themed dialogs.AlertDialog
and AlertDialog.Builder
classes to provide an AppCompat themed AlertDialog
.Palette.Builder
class for generating Palette
instances.
from(Bitmap)
method to the Palette
class to start generating a Palette with the returned Palette.Builder
instance.Palette.generate()
and Palette.generateAsync()
methods.getAbsoluteAlignment()
method to the GridLayout.Spec
class.app:theme
for styling Toolbar
. You can now use android:theme
for toolbars on all API level 7 and higher devices andandroid:theme
support for all widgets on API level 11 and higher devices.GuidedStepFragment
, GuidanceStylist
and GuidedActionsStylist
to support creating multi-step decision flows.SortedList
classes to display items in a list order and provide notification of changes to the list.SortedListAdapterCallback
class that can bind a sorted list to a RecyclerView.Adapter
class.ScriptIntrinsicHistogram
class for use as a histogram filter.ScriptIntrinsicResize
class for performing a resize of a 2D allocation.getDrawable()
method to return a drawable object for a specified specific resource ID, screen density, and theme.setImportantForAccessibility()
method so you can indicate if a view should trigger accessibility events.getStatusBarBackgroundDrawable()
method so you can get the status bar background drawable.NotificationCompat.CarExtender.UnreadConversation
class so Android Auto messaging apps can retrieve additional notification data.getProgressCircleDiameter()
method to return the diameter of a circle layout.DrawerLayout
status bar color to colorPrimaryDark
.Base_Widget_AppCompat_Spinner_Underlined
.Widget_AppCompat_AutoCompleteTextView
, MultiAutoCompleteTextView
,TextAppearance_AppCompat_Button
, and Base_Widget_AppCompat_RatingBar
.getRecycledPoolSize()
and setRecycledPoolSize()
methods to allow customized recycled pool sizes.WRAP_CONTENT
attribute to the layout width setting to support wrapped content for title icons.R.transition
in XML to improve transition updates.PlaybackOverlayFragment
class.BrowseFragment
class and the DetailsFragment
class.replace()
method to replace items in an object’s adapter array.MediaRouter
dialogs to use the material design style.getlayoutPosition()
and getadapterPosition()
methods to the RecyclerView
class.classgetChildPosition()
and findViewHolderForPosition()
methods in the RecyclerView
class.getPosition()
method in the RecyclerView.ViewHolder
class.getViewPosition()
method in the RecyclerView.LayoutParams
class.NotificationCompat.WearableExtender
methods to improve the display of barcodes in notifications on wearable devices.
NotificationCompat.CarExtender
class to support Android Auto extensions to notifications.PopupMenu
constructor to support new popup menus.Toolbar
class.SearchView
widget to support displaying the commitIcon
.buttonGravity
attribute from the Toolbar
class.setCardBackgroundColor(ColorStateList)
API to support changing the background color of the CardView
.CardView
to more accurately report its opacity value as TRANSLUCENT
.TOUCH_SLOP_DEFAULT
and TOUCH_SLOP_PAGING
constants to the RecyclerView
class to support touch slop configurations for paging.CardView
.Fragment
transitions for devices running Android 5.0 (API level 21). Be aware that transitions have no effect on devices running Android 4.4 and lower.DocumentFile
to ease the transition from File
while working with document trees. However, this class demands more processing overhead compared to the platform's DocumentsContract
API added in Android 4.4 (API level 19). So you should switch to using DocumentsContract
when running on Android 4.4 and higher.Toolbar
, which generalizes the functionality of ActionBar
for use within app layouts.ActionBarDrawerToggle
, which contains the menu-to-arrow animationSwitchCompat
, a backport of the Switch
widget that was added in Android 4.0 (API level 14).CardView
widget, which provides a material design-compatible implementation for displaying data items.RecyclerView
widget, which provides a flexible list view for providing a limited window into a large data set.Palette
class, which lets you extract prominent colors from an image.BrowseFragment
, DetailsFragment
, and PlaybackOverlayFragment
. For more information about using these user interface widgets, see Building TV Playback Apps.NotificationCompat.WearableExtender
, which allows you to specify wearable-specific features in your notifications.NotificationCompat.Action.WearableExtender
, which allows actions to be added on wearable notifications.NotificationManagerCompat
, which allows you to issue notifications that properly support wearable features.RemoteInput
, which allows a handheld device to receive voice input from a notification that appears on a wearable device.SwipeRefreshLayout
.SwipeRefreshLayout
class, which enables users to refresh the contents of a view with a vertical swipe gesture.PrintHelper
by adding asynchronous handling of printing.DrawerLayout
class approximation of the addChildrenForAccessibility()
method.ActionBarDrawerToggle
.MediaRouteProvider.ProviderMetadata
.MediaRouteChooserDialog
to hide disabled routes.getObbDirs()
, getExternalFilesDirs()
, getExternalCacheDirs()
, and getStorageState()
. These helper methods always return a single file object on devices running Android 4.3 (API level 18) and earlier. When running on Android 4.4 (API level 19) and higher, these methods may return more than one file object.PrintHelper
class that works with the Print APIs to print images with a minimum of code.PopupMenuCompat
and ListPopupWindowCompat
.findFocus()
method in AccessibilityNodeProviderCompat
and the getLiveRegion()
method in AccessibilityNodeInfoCompat
.ScaleGestureDetectorCompat
for accessing new scaling gesture methods.ActionBarDrawerToggle
in right-to-left language displays.AutoScrollHelper
option to consume touch events or allow them to be passed through to other views.BidiFormatter
for handling text strings that combine right to left and left to right-formatted text.ViewPager
to better handle cases where the pager has a measured width of zero in the initial layout processing.DrawerLayout
and SlidingPaneLayout
to not throw exceptions for measurement while the project code is being edited.ExploreByTouchHelper
to simplify the implementation of accessibility for custom views.ViewPager
incorrectly populating TYPE_VIEW_SCROLLED
accessibility events.ViewPager
when populating an accessibility event.AccessibilityNodeInfoCompat
by changing CharSequence
inputs to String
objects.AccessibilityRecordCompat
constructor that used an Object
as input.TransportMediator
helper class to manage media transport control, such as play, pause, skip and other media actions.DisplayManagerCompat
for managing display output to one or more device displays.WakefulBroadcastReceiver
helper class for implementing a common pattern of detecting a device wakeup event and passing work off to a Service
while ensuring that the device does not go back to sleep before the handoff is complete.commitContentChanged()
and rollbackContentChanged()
, to AsyncTaskLoader
to help deal with background updates for data changes that are subsequently canceled.ActionBar
to allow implementation of the action bar user interface design pattern back to Android 2.1 (API level 7) and higher. Use of this class requires that you implement your activity by extending the new ActionBarActivity
class.Added a new mediarouter library that provides support for the Google Cast developer preview. The v7 mediarouter library APIs provide a means of controlling the routing of media channels and streams from the current device to external screens, speakers, and other destination devices, with compatibility back to Android 2.1 (API level 7). See V7 mediarouter library for more information.
The v7 mediarouter library APIs introduced in Support Library r18 are subject to change in later revisions of the Support Library. At this time, we recommend using the library only in connection with the Google Cast developer preview.
DrawerLayout
for creating a Navigation Drawer that can be pulled in from the edge of a window.SlidingPaneLayout
widget for creating linked summary and detail views that appropriately adapt to various screen sizes.ActionBarDrawerToggle
as a way to tie together the functions of DrawerLayout
and ActionBar
.ViewDragHelper
as a new common component for dragging views within a parent view.ScrollerCompat
to provide Scroller
and OverScroller
compatibility support.FileProvider
to allow sharing of private files between applications.ViewPager
to throw an exception if the associated PagerAdapter
class is modified without a call to notifyDataSetChanged()
.ViewPager
children drawing sort order.GestureDetectorCompat
to dispatch missing onSingleTapConfirmed(MotionEvent)
calls between tap timeout and long press events.GridLayout
to provide support for the GridLayout
layout object.android.support.v7.widget.Space
which can be used to create blank areas within a GridLayout
layout object.ViewPager
.ViewPager
to select the wrong page.removeView()
method during layout for ViewPager
.SearchViewCompat
where using the back button to dismiss does not clear the search text. This fix only applies to host API levels 14 and higher.Fragment
classes.FragmentManager
debugging.FragmentTabHost
where fragment and tab interaction could result in a ListView
state loss.FragmentStatePagerAdapter
.PageTransformer
interface to ViewPager
to allow applications to supply a custom transition behavior for scrolling.TaskStackBuilder
from current release.PagerTitleStrip
to correctly track the PagerAdapter
currently in use.PagerTitleStrip
.PagerTabStrip
to properly respect padding when drawing an underline.AccessibilityEventCompat
.ViewCompat
.performAccessibilityAction()
method to ViewCompat
.GestureDetectorCompat
.AtomicFile
class.make
methods in IntentCompat
.trimToSize()
method in LruCache
utility class.ConnectivityManagerCompat
to get NetworkInfo from a CONNECTIVITY_ACTION
broadcast.NotificationCompat
.PagerTabStrip
support, providing enhanced functionality beyond PagerTitleStrip
.PagerTitleStrip
and PagerTabStrip
, including setAllCaps
option, title alignment, appearance improvements, minimum width constraints and touch navigation issues.ViewPager
page gutters, which helps the ViewPager
class provide paging support for content with a large horizontal scroll range, such as a map.ViewPager
, including size and data set change problems, page positioning, user interaction, scroll tracking and keyboard navigation problems.Fragment
, including proper handling of onActivityResult()
when the target fragment no longer exists, dispatching selection events to invisible fragments, improved FragmentTransaction.replace()
behavior and added better state handling for fragments being moved out of view.postOnAnimation()
method in ViewCompat
.NavUtils
to use Android 4.1 (API level 16) Up navigation functionality when available.AccessibilityNodeInfoCompat
, to follow fixes made in Android 4.1 (API level 16).ViewPager
.TaskStackBuilder
to reflect API changes in Android 4.1 (API level 16).TaskStackBuilder
to allow it to be used from a Service.EXTRA_HTML_TEXT
to ShareCompat
.NotificationCompat.Builder
to support the setNumber()
method.ConnectivityManagerCompat
for the isActiveNetworkMetered()
method.PendingIntent
objects generated by TaskStackBuilder
..classpath
and .project
files for the gridlayout library project.ShareCompat
, which provides helper classes for sending and receiving content for social sharing applications, including new metadata for attributing shared data to the source app. This class also provides compatible integration with the new ShareActionProvider
in Android 4.0.NavUtils
and TaskStackBuilder
to provide support for implementing the Android Design guidelines for navigation. These additions include a way to implement the action bar's Up button across versions. For an example implementation of this pattern, see the AppNavigation sample in (<em><sdk></em>/samples/<em><platform></em>/AppNavigation
).NotificationCompat.Builder
to provide a compatibility implementation of Android 3.0's Notification.Builder
helper class for creating standardized system notifications.Note: Reference for support library APIs are now available with the framework references, for example: android.support.v4.app
.
ViewPager
. Decorative views may be supplied as child views of a pager in XML layout.PagerAdapter.getPageTitle()
to supply title strings for pages, which defaults to no title for each page.PagerTitleStrip
, a non-interactive title strip, that can be added as a child of ViewPager. Developers can supply text appearance and color, as well as layout sizing and gravity information.PagerAdapter
methods to take ViewGroup objects, rather than View to avoid class casting in adapter implementations.ViewPager
to use Launcher-style fling behavior.setStartDeferred()
method to setUserVisibleHint(boolean)
.AccessibilityDelegateCompat
methods to return empty lists instead of null.AccessibilityDelegateCompat
to support View.AccessibilityDelegate
.AccessibilityEventCompat
to support AccessibilityEvent
.AccessibilityManagerCompat
to support AccessibilityManager
.AccessibilityNodeInfoCompat
to support AccessibilityNodeInfo
.AccessibilityRecordCompat
to support AccessibilityRecord
.AccessibilityServiceInfoCompat
to support AccessibilityServiceInfo
.ViewGroupCompat
to support accessibility features in ViewGroup
.ViewCompat
to support accessibility features in View
.Drawable
can be provided to fill the margins.EdgeEffect
.EdgeEffectCompat
to support EdgeEffect
.LocalBroadcastManager
to allow applications to easily register for and receive intents within a single application without broadcasting them globally.ViewCompat
to check for and set overscroll modes for View
s on Android 2.3 and later.FragmentActivity
to retain custom, non-configuration instance data.Loader
bug that caused issues in canceling AsyncTask
s when running on Froyo and older versions of the platform. The support code now uses its own version of AsyncTask
to keep the same behavior on all platform versions.Fragment.SavedState
MotionEventCompat
to support newer MotionEvent
APIsVelocityTrackerCompat
to support a newer VelocityTracker
APIsViewConfigurationCompat
to support a newer ViewConfiguration
APIsViewPager
: A ViewGroup
that manages the layout for the child views, which the user can swipe between.PagerAdapter
: An adapter that populates the ViewPager
with the views that represent each page.FragmentPagerAdapter
: An extension of PagerAdapter
for flipping between fragments.FragmentStatePagerAdapter
: An extension of PagerAdapter
for flipping between fragments that uses the library's support for Fragment.SavedState
.FragmentPagerAdapter
and FragmentStatePagerAdapter
to support the horizontal paging. These are exactly the same as the APIs added to the v4 support library, but rely on other platform components in Android 3.2. Use this library instead of v4 if you're developing for Android 3.2 and higher (all other APIs in the v4 library are already available with API level 13).
Fragment.onActivityResult()
bugInitial release with the v4 library.