支持库

支持库功能

Android 支持库软件包含可以添加至应用的多个库。每个库均支持特定范围的 Android 平台版本和功能。

本指南介绍了各支持库提供的重要功能和版本支持,从而帮助您决定在应用中添加哪些支持库。一般而言,我们建议添加 v4 支持库和 v7 appcompat 库,因为它们支持一系列 Android 版本,并且可以为推荐的用户界面模式提供 API。

要使用以下任一库,您必须将库文件下载到 Android SDK 安装位置中。请按照支持库设置中下载支持库的说明完成此步骤。要在应用中添加特定支持库,您还必须执行其他步骤。有关如何在应用中添加支持库的重要信息,请参阅下面各个库内容的末尾部分。

v4 支持库


这些库旨在与 Android 2.3(API 级别 9)及更高版本搭配使用。与其他支持库相比,它们包含的 API 集合最大,包括对应用组件、用户界面功能、辅助功能、数据处理、网络连接以及编程实用工具的支持。

如需了解有关 v4 支持库所提供类和方法的完整详细信息,请参阅 API 参考中的 android.support.v4 软件包。

:在支持库修订版 24.2.0 之前,存在一个 v4 支持库。为了提高效率,此库拆分成多个模块。出于向后兼容的考虑,如果您在 Gradle 脚本中列出了 support-v4,您的 APK 将包含所有的 v4 模块。不过,要减少 APK 大小,我们建议仅列出应用需要的特定模块。

v4 compat 库

为众多框架 API 提供兼容性包装器,例如 Context.obtainDrawable() 和 View.performAccessibilityAction()

此库的 Gradle 构建脚本依赖关系标识符如下所示:

com.android.support:support-compat:24.2.0

v4 core-utils 库

提供大量实用程序类,例如 AsyncTaskLoader 和 PermissionChecker

此库的 Gradle 构建脚本依赖关系标识符如下所示:

com.android.support:support-core-utils:24.2.0

v4 core-ui 库

实现各种 UI 相关组件,例如 ViewPagerNestedScrollView 和 ExploreByTouchHelper

此库的 Gradle 构建脚本依赖关系标识符如下所示:

com.android.support:support-core-ui:24.2.0

v4 media-compat 库

向后移植部分媒体框架,包括 MediaBrowser 和 MediaSession

此库的 Gradle 构建脚本依赖关系标识符如下所示:

com.android.support:support-media-compat:24.2.0

v4 fragment 库

添加对使用片段封装用户界面和功能的支持,从而使应用能够提供可以在大屏幕设备与小屏幕设备之间进行调节的布局。此模块依赖于 compatcore-utilscore-ui 和 media-compat

此库的 Gradle 构建脚本依赖关系标识符如下所示:

com.android.support:support-fragment:24.2.0

Dalvik 可执行文件分包支持库


此库可以为使用多个 Dalvik Executable (DEX) 文件开发应用提供支持。引用超过 65536 个方法的应用须使用 Dalvik 可执行文件分包配置。如需了解有关使用 Dalvik 可执行文件分包的详细信息,请参阅使用超过 6.4 万种方法开发应用

此库的 Gradle 构建脚本依赖关系标识符如下所示:

com.android.support:multidex:1.0.0

v7 支持库


一些库旨在与 Android 2.3(API 级别 9)及更高版本搭配使用。这些库提供了特定的功能集,并且可以单独添加到应用中,与其他库互不影响。

v7 appcompat 库

此库添加了对操作栏用户界面设计模式的支持。此库包含对 Material Design 用户界面实现的支持。

:此库依赖于 v4 支持库。

下面是 v7 appcompat 库中包含的一些关键类:

  • ActionBar - 提供操作栏用户界面模式的实现。如需了解有关使用操作栏的详细信息,请参阅操作栏开发者指南。
  • AppCompatActivity - 添加一个应用 Activity 类,此类可作为使用支持库操作栏实现的 Activity 的基础类。
  • AppCompatDialog - 添加一个对话框类,此类可作为 AppCompat 主题对话框的基础类。
  • ShareActionProvider - 包含对可以添加到操作栏中的标准化分享操作(例如电子邮件或发帖至社交应用)的支持。

此库的 Gradle 构建脚本依赖关系标识符如下所示:

com.android.support:appcompat-v7:24.2.0

v7 cardview 库

此库添加了对 CardView 小部件的支持,让您能够在卡片内显示信息,从而使应用具备一致的外观。这些卡片对 Material Design 实现非常有用,并在电视应用布局中广为使用。

此库的 Gradle 构建脚本依赖关系标识符如下所示:

com.android.support:cardview-v7:24.2.0

v7 gridlayout 库

下载 Android 支持库后,此库可以添加对 GridLayout 类的支持,让您能够使用网状方格安排用户界面元素。如需了解有关 v7 gridlayout 库 API 的详细信息,请参阅 API 参考中的 android.support.v7.widget 软件包。

此库的 Gradle 构建脚本依赖关系标识符如下所示:

com.android.support:gridlayout-v7:24.2.0

v7 mediarouter 库

此库可以提供 MediaRouterMediaRouteProvider 和支持 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 库

v7 palette 支持库包含 Palette 类,此类让您可以从图像中抽取突出颜色。例如,音乐应用可以使用 Palette 对象从专辑封面抽取主要颜色,然后使用这些颜色创建一个色彩协调的歌曲标题卡。

此库的 Gradle 构建脚本依赖关系标识符如下所示:

com.android.support:palette-v7:24.2.0

v7 recyclerview 库

recyclerview 库添加了 RecyclerView 类。此类能够为 RecyclerView 小部件提供支持,RecyclerView 是一种通过提供有限的数据项窗口有效显示大数据集的视图。

此库的 Gradle 构建脚本依赖关系标识符如下所示:

com.android.support:recyclerview-v7:24.2.0

v7 Preference 支持库

首选项软件包提供的 API 支持添加 preference 对象(例如 CheckBoxPreference 和 ListPreference),方便用户修改 UI 设置。

v7 Preference 库添加了对接口(例如 Preference.OnPreferenceChangeListener 和 Preference.OnPreferenceClickListener)以及类(例如 CheckBoxPreference 和 ListPreference)的支持。

此库的 Gradle 构建脚本依赖关系标识符如下所示:

com.android.support:preference-v7:24.2.0

v8 支持库


此库旨在与 Android 2.3(API 级别 9)及更高版本搭配使用。此库提供了特定的功能集,并且可以单独添加到应用中,与其他库互不影响。

v8 renderscript 库

此库旨在与 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
}

v13 支持库


此库旨在用于 Android 3.2(API 级别 13)及更高版本。它添加了对带有 (FragmentCompat) 类和其他片段支持类的 Fragment 用户界面模式的支持。如需了解有关片段的详细信息,请参阅片段开发者指南。如需了解有关 v13 支持库 API 的详细信息,请参阅 API 参考中的 android.support.v13 软件包。

此库的 Gradle 构建脚本依赖关系标识符如下所示:

com.android.support:support-v13:24.2.0

v14 Preference 支持库


android.support.v14.preference 软件包提供的 API 添加了对首选项接口(例如 PreferenceFragment.OnPreferenceStartFragmentCallback 和 PreferenceFragment.OnPreferenceStartScreenCallback)以及类(例如 MultiSelectListPreference 和 PreferenceFragment)的支持。如需了解有关 v14 Preference 支持库 API 的详细信息,请参阅 API 参考中的首选项软件包。

此库的 Gradle 构建脚本依赖关系标识符如下所示:

com.android.support:preference-v14:24.2.0

适用于电视的 v17 Preference 支持库


android.support.v17.preference 软件包提供的 API 可以在电视设备上提供首选项接口,包括对 LeanbackListPreferenceDialogFragment.ViewHolder.OnItemClickListener 接口和类的支持,例如 BaseLeanbackPreferenceFragment 和 LeanbackPreferenceFragment。如需了解有关 v17 Preference 支持库 API 的详细信息,请参阅 API 参考中的首选项软件包。

此库的 Gradle 构建脚本依赖关系标识符如下所示:

com.android.support:preference-leanback-v17:24.2.0

v17 Leanback 库


android.support.v17.leanback 软件包提供的 API 支持在电视设备上构建用户界面。它为电视应用提供了一些重要的小部件。一些值得注意的类包括:

此库的 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

Recent Support Library Revisions

This page provides details about the most recent Support Library package releases. For earlier releases, see the Support Library Revisions Archive.

Revision 27.0.2 Release


(November 2017)

Bug fixes

  • EmojiEditTextHelper throws NullPointerException.
  • IllegalStateException: Fragment has not been attached yet.
  • Unable to dismiss 'Cast' icon pop-up by tapping anywhere on the screen.
  • MediaMetadataCompat throws BadParcelableException.

Revision 27.0.1 Release


(November 2017)

Bug fixes

  • LifecycleRegistry is in the wrong state after startActivityForResult() is called. (Issue 65665621)
  • The color of disabled buttons is too light on older API levels.
  • After a user scrolls, they cannot click on an item in a RecyclerView. (AOSP issue 66996774)
  • In Talkback, clicking on more options does not cause the system to announce the new popup or to add focus to the new options.

Revision 27.0.0 Release


(October 2017)

API Diffs

API Changes

  • Fragment can use support library versions of Transition for fragment transitions, including shared-element transitions.
  • Content paging library (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().
  • Leanback gets new features and polish, and loses some deprecated classes, such as:
    • 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.
    • Infrastructure added to support media players with variable controls, adding optional controls for fast-forward, repeat, shuffle, next, previous, and rewind.
    • Removal of MediaControllerGlue, PlaybackControlGlue, PlaybackControlSupportGlue, and PlaybackOverlayFragment.
  • For testing, the PollingCheck utility is ported from AOSP CTS. It polls for a condition to happen within a timeout window.
  • Infrastructure added to support runtime permissions on Instant Apps for Android 5.0, using PermissionCompatDelegate.
  • Trusted custom tabs now supported, along with the ability to define a relationship between an application and an origin URI.
  • Android Wear ambient mode support is simplified with the use of the AmbientMode headless fragment, which also makes supporting ambient mode compatible with the use of Architecture Components.
  • The Wear team seeks developer feedback around this significant change. For more information, see the Android Wear Release Notes.
  • Some deprecated classes removed as we move away from old pre-V14 APIs, such as android.support.v7.NotificationCompat (use v4 NotificationCompat instead), KeyEventCompatParallelExecutorCompat, and SearchViewCompat.
  • Migrated wear manifest metadata constants are all now available via android.support.wear.utils.MetadataConstants.
  • Ambient mode support is now available for all Activities, not just WearableActivity. For more information, see the AmbientMode reference.
  • RoundedDrawable now supports XML inflation.

Bug fixes

  • Application crashes with support library 27 and downloadable font
  • Downloadable fonts not working for new projects created after updating SDK
  • SpeechRecognizer API is broken in latest upgrade
  • Fragment-related crash during draw after removing animated View
  • support-leanback-demos media playback are all broken
  • Android Support Library is adding <meta-data> into manifest
  • FontResourcesParserCompat should understand android: attrs
  • Leanback Glue does not support Pause input key
  • Unresolved symbol in IDE when multiple packages share the same artifact id.
  • Null Pointer Exception in CarExtender
  • Wrong shuffle / repeat mode set PlaybackState after creating MediaController
  • Library cluster default posters are running onto next cluster while navigating
  • Recommendation card metadata is cut off
  • IllegalArgumentException at RecyclerView.attachViewToParent()
  • ClassNotFoundException when unmarshalling SavedState (AOSP issue 37133281)
  • Focus gets stuck in RecyclerView
  • Fix ANR in Leanback LayoutManager

Revision 26.1.0 Release


(September 2017)

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.

Important changes

Revision 26.0.2 Release


(August 2017)

Bug fixes

  • Menu icons are flattened on Support Library 26.0.0
  • GuidedAction.multilineDescription doesn't work properly with Leanback

Revision 26.0.1 Release


(August 2017)

Bug fixes

  • FontCompat 26.0.0 crashes on O-MR1 devices
  • 26.0.0 Design Support Library should not include multidex support (issue 63999442))
  • AppBarLayout now has 300px of left padding since 26.0.0
  • PlaybackTransportControl navigation is broken
  • Fragment.onCreateView is called sometime before onCreate finishes
  • android.os.BadParcelableException: ClassNotFoundException when unmarshalling: android.support.v4.media.MediaMetadataCompat

Revision 26.0.0 Release


(July 2017)

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.

Important changes

  • The minimum SDK version has been increased to 14. As a result, many APIs that existed only for compatibility with pre-14 API levels have been deprecated. Clients of these APIs should migrate to their framework equivalents as noted in the reference page for each deprecated API.
  • The Wear UI Library contains classes that help you implement patterns and layouts that work on Wear devices. For more information, see Using the Wear UI Library.
  • The Percent Support module has been deprecated. Clients of this module should migrate to the new 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:

New APIs

  • New fastScrollEnabled boolean flag for RecyclerView. If enabled, fastScrollHorizontalThumbDrawablefastScrollHorizontalTrackDrawable,fastScrollVerticalThumbDrawable, and fastScrollVerticalTrackDrawable must be set.

API Diffs

Bug fixes

  • Infinite loop in RecyclerView.toString()
  • ResourceNotFoundException running Kotlin project on API 16 AVD after upgrading to Canary 6
  • java.lang.AssertionError in design view with support library 26.0.0-beta2
  • Android Studio layout preview broken for Support Library widgets
  • Preference.setSingleLineTitle() is ignored if the Preference was not created with attributes
  • DAC "Since" annotations are wrong for 25.3.0 / 25.4.0 revisions of Support Library
  • ResourcesCompat.getFont() throws exception
  • Toolbar title not in bold font
  • Auto sizing with maxLines produces unexpected results
  • NullPointerException in TextView.checkForRelayout()
  • AppCompatTextViewAutoSizeHelper.setRawTextSize() calls requestLayout() during layout
  • EmojiAppCompatTextView crashes
  • Autosize TextView does not adjust automatically when text is changed
  • Screen corruption in Instacart
  • UnsupportedOperationException in MenuItemCompat
  • NotificationCompat doesn't fully extract actions on API 24 or higher
  • CoordinatorLayout anchoring problems on layout updates

Revision 26.0.0 Beta 2


(June 2017)

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.

New APIs

API Diffs

Bug fixes

  • Android O SDK drop causes loss of italics in TextViews
  • Null pointer exception when connecting to MediaBrowserServiceCompat
  • TextInputLayout must set hints on onProvideAutofillStructure()
  • Stack overflow when using TextView autosize on O

Revision 26.0.0 Beta 1


(May 2017)

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.

Important changes

  • 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().
  • All instances of the findViewById() method now return <T extends View> T instead of View. This change has the following implications:
    • This may result in existing code now having ambiguous return type, for example if there is both someMethod(View) and someMethod(TextView)that takes the result of a call to findViewById().
    • When using Java 8 source language, this requires an explicit cast to View when the return type is unconstrained (for example,assertNotNull(findViewById(...)).someViewMethod()).
    • Overrides of non-final findViewById() methods (for example, Activity.findViewById()) will need their return type updated.

New APIs

  • 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.
  • Path motion is supported in 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).
  • Physics-based animation:
    • New FlingAnimation that supports animating with an initial velocity and smoothly slows down.
    • Subclasses of DynamicAnimation support animating custom property for any object.
    • Both 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.

  • Font support in XML:
    • ResourcesCompat.getFont allows loading font resources—including font-family XML—that may be used with TextView.setTypeface().
    • When using AppCompat, TextView supports specifying a font resource or font-family XML via the android:fontFamily XML attribute.
    • Use XML font-family to create families of fonts with style and weight variations. (If you use the support library classes to do this, use the app:attributes as well as the android: attributes.)
  • Downloadable fonts:
    • New FontsContractCompat that allows you to request fonts from a font provider instead of bundling them in your app.
    • Fonts can also be requested in XML and used in layouts.
  • Emoji compatibility library:
    • 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.
  • Autosizing TextView:
    • New methods in TextViewCompat as well as XML attributes to control autosizing in TextView.
  • Leanback playback controls with seek support:
    • New PlaybackTransportRowPresenter that renders playback controls with a SeekBar.
    • New PlaybackTransportControlGlue that works with PlaybackTransportRowPresenter and supports seek.
    • New base class PlaybackSeekDataProvider for app to provide seek thumbnails to PlaybackTransportControlGlue.
  • Preferences Data Store:
    • PreferenceDataStore now allows you to implement your own preferences storage, set with new methods in Preference and PreferenceManager.

Known Issues

  • Downloadable Fonts and Emoji compatibility integration with Google Play Services only works on Google Play Services v11+, which is currently available through the Google Play Services beta program.

Bug fixes

  • MediaBrowserCompat.search() API does not work (AOSP issue 262170)
  • ViewCompat.postInvalidateOnAnimation() throws exception (AOSP issue 80146)
  • onActivityCreated() called for fragments in destroyed Activity
  • RecyclerView.isComputingLayout() should return true during prefetch
  • When a Fade 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)

Revision 26.0.0 Alpha 1


(March 2017)

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.

Important changes

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.

  • The support-percent module has been deprecated. Clients of this module should migrate to the new ConstraintLayout widget, which is provided as a separate artifact in SDK Manager.
  • The support-fragment module no longer has a dependency on the support-media-compat module.

New APIs

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.

Bug fixes

  • In some cases simple 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.

Revision 25.4.0


(June 2017)

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.

Important changes

  • 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.
  • Concurrent with this support library release, we are also releasing multidex version 1.0.2. This version includes the following important changes:
    • Allows multidexing of instrumentation APK.
    • Deprecates MultiDexTestRunner (AndroidJUnitRunner should be used instead).
    • Provides better protection against some bad archive extraction management of the app.
    • Fixes a bug that could lead to abandoned temporary files.
    • Provides faster installation when done in concurrent process.
    • Fixes an installation bug on API 19 and 20.

New and Modified APIs

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:pathDatain the interpolator’s XML).

API Diffs

Fixed issues

  • Null pointer exception when connecting to MediaBrowserServiceCompat
  • MediaBrowserCompat.search() API does not work (AOSP issue 262170)
  • BrowseFragment onItemClicked callbacks broken in 25.3.0
  • NullPointerException while scrolling up and down in VerticalGridView in 25.3.1
  • ClassCastException in SimpleArrayMap.allocArrays()

Revision 25.3.1


(March 2017)

Fixed issues

  • SwitchCompat requires minimum SDK version of 14 or higher. (AOSP issue 251302)
  • Physics-based animation updateListener skips the first frame.
  • BottomNavigationView label animation is broken.

Revision 25.3.0


(March 2017)

Important changes

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" />

Deprecations

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
The boolean method 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.

New and Modified APIs

appcompat-v7
The new method ActionBarDrawerToggle.setDrawerSlideAnimationEnabled(boolean) simplifies disabling the navigation drawer toggle icon's animation.
customtabs
Added support for message channels. See the CustomTabsService.requestPostMessageChannel() and CustomTabsService.postMessage()reference for details.
dynamic-animation
New physics-based animation library that provides a set of APIs for building animations that dynamically react to user input.
leanback-v17
Added support for parallax backgrounds. See the Parallax reference for details.
Added TimePicker widget for picking times on a TV interface.
mediacompat
Added search functionality. See the MediaBrowserCompat.search() and MediaBrowserServiceCompat.onSearch() reference for details.
Added support for shuffle and repeat modes. See the MediaSessionCompat.setRepeatMode() and setShuffleModeEnabled() reference for details.

Fixed issues

Revision 25.2.0


(February 2017)

Important Changes

Fixed issues

  • This release fixes a severe mediarouter issue in which using an A2DP device and media routing APIs could cause the device to become unresponsive, requiring a reboot.
  • The FragmentManager.FragmentLifecycleCallbacks class is now static.

Fixed issues

  • Showing a slide presentation with screen mirroring causes device to disconnect from Wi-Fi
  • Media button did not properly handle media apps that did not register themselves with setMediaButtonReceiver()
  • VectorDrawable error with string resource (AOSP issue 232407)
  • TextInputLayout overlays hint and text if text is set by XML (AOSP issue 230171)
  • Memory leak in MediaControllerCompat (AOSP issue 231441)
  • RecyclerViewLayoutTest.triggerFocusSearchInOnRecycledCallback() crashing
  • RecyclerView crashes when recycling view holders (AOSP issue 225762)
  • getAllowGeneratedReplies() incorrectly returns false for actions inside a WearableExtender

Revision 25.1.1


(January 2017)

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.

Important Changes

  • 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).

  • Fragments can now postpone their transitions and animations until they are ready using Fragment.postponeEnterTransition() and Fragment.startPostponedEnterTransition(). This API is similar to Activity.postponeEnterTransition() and Activity.startPostponedEnterTransition() used with Activity Transitions.

Fixed issues

Revision 25.1.0


(December 2016)

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.

Important Changes

  • Clients of nested 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.
  • When a client specifies a widget tint via appcompat tinting (for example, 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.

New and Modified APIs

Fixed issues

  • Password visibility toggle fails accessibility tests.
  • Appcompat doesn't respect state_enabled on pre-L devices.
  • Added focus recovery mechanism to RecyclerView. This also fixed support pref fragments broken focus when using DPAD navigation such as on Android TV devices.
  • Leanback: BrowseFragment crashes with headers disabled and empty adapter.
  • Appcompat: AlertDialog is too wide.
  • InputContentInfoCompat calls requestPermission() when it should call releasePermission().
  • MediaBrowserCompat crashes.
  • CoordinatorLayout measures/lays out views when visibility is set to GONE.
  • Could not tint AnimatedVectorDrawableCompat on API level below 24
  • Leanback library triggers spurious lint errors
  • Palette library caused test failures on every API level
  • RecyclerView failed tests on Leanback
  • RecyclerView crashes when recycling view holders (AOSP issue 225762)
  • Fragment.onDestroy() not called for fragment in backstack
  • CollapsingToolbarLayout scrim is not drawn when collapsed
  • CoordinatorLayout.offsetChildByInset() throws IllegalArgumentException
  • Animating RecyclerView items detach inner RecyclerViews, prevent future prefetches
  • Attached RecyclerView items can't be nested-prefetched
  • Prefetch data for nested RecyclerView items is discarded during first layout
  • RecyclerView prefetch fails if two drag events arrive at same position
  • RecyclerView should speculatively layout while RenderThread is rendering
  • Night-configured color resources converted to Drawables are not always properly purged from Resources cache
  • FloatingActionButton: 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 leaves

A complete list of public bug fixes is available on the AOSP Issue Tracker.

Deprecations

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.

Revision 25.0.1


(November 2016)

Fixed issues

A complete list of public bug fixes is available on the AOSP Issue Tracker.

Revision 25.0.0


(October 2016)

Important changes

  • 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.

New APIs

  • android.support.design.widget.BottomNavigationView class implements the bottom navigation pattern from the Material Design spec.
  • New 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.
  • New decorated styles in android.support.v7.app.NotificationCompatDecoratedCustomViewStyle and DecoratedMediaCustomViewStyle, mirror classes added in platform API 24.

Fixed issues

A complete list of public bug fixes is available on the AOSP Issue Tracker.

Revision 24.2.1


September 2016

Fixed issues:

A complete list of public bug fixes is available on the AOSP Issue Tracker.

Revision 24.2.0


August 2016

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.

v4 Support Library split

With this release, the v4 Support Library has been split into several smaller modules:

support-compat
Provides compatibility wrappers for new framework APIs, such as Context.getDrawable() and View.performAccessibilityAction().
support-core-utils
Provides a number of utility classes, such as AsyncTaskLoader and PermissionChecker.
support-core-ui
Implements a variety of UI-related components, such as ViewPagerNestedScrollView, and ExploreByTouchHelper.
support-media-compat
Backports portions of the media framework, including MediaBrowser and MediaSession.
support-fragment
Backports the fragment framework. This module has dependencies on support-compatsupport-core-utilssupport-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.

API updates

Behavior changes

  • If you use the appcompat library's day/night functionality, the system now automatically recreates your activity whenever the day/night mode changes (either because of the time of day, or because of a call to AppCompatDelegate.setLocalNightMode()).
  • Snackbar now draws behind the navigation bar if the status bar is translucent.

MediaRouter library

Bluetooth devices are no longer listed as media routes. Routing audio to Bluetooth devices is now solely controlled at the Android system level.

Deprecations

Deprecated classes and methods are subject to removal in a future release. You should migrate away from these APIs as soon as possible.

  • Several methods on the following classes were only required for API 8 and lower, and should no longer be used. Instead, use the framework implementations.
    • 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.
  • You should not instantiate the 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().
  • Several abstract classes have been deprecated and replaced with interfaces that more closely reflect their framework equivalents.
  • CustomTabsSession.setToolbarItem() has been deprecated and replaced by the RemoteViews-based setSecondaryToolbarViews().

Bug fixes

The following known issues have been fixed with release 24.2.0:

  • Ensure SwipeRefreshLayout indicator is shown when setRefreshing(true) is called before the first measurement pass (AOSP issue 77712)
  • Prevent TabLayout from flickering when changing pages (AOSP issue 180454)
  • Avoid 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.

Revision 24.1.1


July 2016

Fixed issues:

  • Fixes an issue in the 24.1.0 release which affected resource IDs shared between support libraries. This issue caused apps that depended on support libraries with resources (such as design and appcompat) to encounter issues caused by resource ID mismatches.

Revision 24.1.0


July 2016

Changes for v4 Support Library:

Fixed issues:

  • TabLayout.setCustomView(null) results in NullPointerException (AOSP issue 214753)
  • TabLayout incorrectly highlights custom tabs (AOSP issue 214316)
  • AppCompatTextHelper uses incorrectly sorted attribute array (AOSP issue 214366)
  • Unable to reference VectorDrawable from drawable container XML when using custom ContextWrapper (AOSP issue 214055)
  • ViewDragHelper.saveLastMotion() throws ArrayIndexOutOfBoundsException (AOSP issue 212945)
  • BottomSheetBehavior expands to old content height when using setState(STATE_EXPANDED) (AOSP issue 213660)
  • CollapsingToolbarLayout doesn’t handle pinnable children with top or bottom margins (AOSP issue 213001)
  • Leanback browse title does not support RTL alignment (AOSP issue 213461)
  • PagerTabStrip disappears due to missing inherited annotation (AOSP issue 213359)
  • Data binding throws NullPointerException when using Boolean to set conditional flags (AOSP issue 191841)
  • CoordinatorLayout does not respond to setFitsSystemWindows() (AOSP issue 212720)
  • BottomSheetBehavior crashes when setting initial state (AOSP issue 203114)
  • ViewPager skips pages if the page index is a large value (AOSP issue 211734)
  • BottomSheetBehavior does not work with dynamic layouts (AOSP issue 205226)

Revision 24.0.0


June 2016

Changes for v4 Support Library:
  • Added Fragment.commitNow() for synchronous commit
  • Added NotificationCompat.MessagingStyle for multi-party conversations
  • Added NotificationManagerCompat.areNotificationsEnabled() and getImportance()
  • MediaSessionCompat now mirrors the functionality of MediaSession and no longer calls setMediaButtonReceiver() automatically

Note: 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.

Changes for v7 appcompat library:
  • Added support for referencing themed ColorStateList objects from XML
Changes for Design Support Library:
Changes for v17 Leanback library:
  • Added OnboardingFragment to provide first-run welcome and setup flow
Changes for custom tabs:
  • Added support for providing a RemoteViews hierarchy for the secondary toolbar
  • Added CustomTabsClient.connectAndInitialize() for one-line warm up

Revision 23.4.0


May 2016

Changes for v4 Support Library:
  • Fixed issue where fragments were added in the wrong order. (Issue 206901)
  • Fixed issue where app bar wasn't drawn after being scrolled offscreen. (Issue 178037)
Changes for v7 appcompat library:
Changes for Design Support Library:
Changes for Vector Drawable library:

Revision 23.3.0


April 2016

Changes for v4 Support Library:
  • Added 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).
  • Fixed a memory leak in MediaBrowserServiceCompat.mConnections. (Issue 205220)
  • Fixed issue where ViewPager does not account for page margins when flipping page. (Issue 203816)
  • Fragment.onRequestPermissionsResult() is now delivered to child fragments.
Changes for v7 appcompat library:
Changes for v7 mediarouter library:
Changes for v7 Preference library:
Changes for v7 recyclerview library:
Changes for Design Support Library:

Revision 23.2.1


March 2016

Changes for v4 Support Library:
Changes for v7 appcompat library:
  • Reverted dependency on vector assets so that developers using the appcompat library are not forced to use VectorDrawable and its associated build flags.
  • Fixed a compatibility issue with Night Mode and API level 23. (Issue 201910)
  • Fixed a compatibility issue with SwitchCompat and API level 7. (Issue 201942)
  • Fixed an issue with propagating configuration values in Resources objects Issue 201928
  • Fixed a compatibility issue where the android.support.v7.app.NotificationCompat.MediaStyle cancel button becomes invisible on API level 21 and below. (Issue 202156)
  • Fixed a compatibility crash with AppCompatSpinner on API level 21 and below. (Issue 202246)
  • Fixed an issue where the app:textAllCaps = "false" style did not work. (Issue 202117)
  • Fixed a crash when restoring SearchView. (Issue 201836)
  • Fixed a memory leak that occurs when tinting drawable resources using AppCompat. (Issue 202379)
  • Fixed an issue with KeyEvent on API level 11 and lower. (Issue 202939)
Changes for v7 cardview library:
Changes for v7 recyclerview library:
Changes for v7 mediarouter library:
Changes for v17 Leanback Library:
  • Fixed an issue with GridLayout.onAddFocusables() that caused the wrong item to be selected.
  • Fixed issue with GuidedStepFragment actions disappearing after an action was collapsed.
Changes for Design Support Library:
Changes for VectorDrawableCompat:
  • Fixed a bug where the wrong variable was read for android:tintMode. (Issue 201907)

Revision 23.2.0


February 2016

Changes for v4 Support library:
  • Added 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.
  • The system now calls onActivityResult() for a nested FragmentActivity.
Changes for v7 AppCompat library:
  • Added Night Mode functionality to API level 14 and higher. Switch between Material Light and Material Dark Themes based on the time of day or app-specific setting.
    • Day and night themes can be found here: <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.
Changes for v7 mediarouter library:
Changes for Design support library:
  • Added support for bottom sheets. An interaction plugin, 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.
Changes for the CustomTabs support library:
  • Chrome Custom Tabs now allows apps to include a bottom bar with action buttons in addition to the existing top action button.
  • 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.
Added VectorDrawable support library:
  • Added Classes:
    • VectorDrawableCompat
    • AnimatedVectorDrawableCompat
  • Adds support for 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.
  • This library is now a dependency of the v7 AppCompat library, allowing developers and AppCompat to easily use vector drawables. To use VectorDrawableCompat within an ImageButton or ImageView, use the app:srcCompat XML attribute or setImageResource() method.
  • To keep referencing attribute IDs on API level 20 or lower, add the following appt flag to your build,gradle file:
    • If you are building with Android Plugin for Gradle 1.5.0 or lower, add the following to your 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"
        }
      }
    • If you are building with Android Plugin for Gradle 2.0.0 or higher, add the following to your build.gradle file:
    • android {
        defaultConfig {
          vectorDrawables.useSupportLibrary = true
        }
      }
Changes for v17 Leanback Library:
  • Added new capabilities to GuidedStepFragment, which is a component that guides users through a decision or series of decisions:
    • Added button actions to GuidedAction:
      • GuidedStepFragment.setButtonActions(): sets a list of GuidedAction buttons that the user may select from the Actions view.
    • Description fields are now editable:
      • GuidedAction.Builder.descriptionEditable(): when passing true, sets the action’s description to be editable.
      • GuidedAction.getEditDescription(): returns the editable description as a CharSequence.
    • Added drop-down lists of sub-actions:
      • GuidedAction.setSubActions(): sets a GuidedAction list as a drop-down menu of sub-actions.
  • Added the GuidedDatePickerAction widget for DatePicker functionality:
    • The date is selected using year, month, and day columns and has a customizable range.
    • 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.
Changes for v7 RecyclerView library:

Revision 23.1.1


November 2015

Changes for v7 recyclerview library:
  • Fixed a crash that occurs when you perform a swipe-to-dismiss action that the ItemTouchHelper utility class provides, and then add an item. (Issue 190500)
Changes for v7 preference library:
Changes for v17 Leanback Support library:
  • Fixed a number of internal issues in this library.
Changes for Design Support library:
  • Added the getHeaderView method to the NavigationView class.
  • Fixed a transparent background issue for a FloatingActionButton object on devices running Android 4.0 (API level 15) and lower. (Issue 183315)

Revision 23.1.0


October 2015

Changes for v4 Support library:
  • Added OnScrollChangedListener interface support to the NestedScrollView widget. It allows you to receive callbacks when the scroll X or Y positions change.
  • Added a 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.
Changes for v7 appcompat library:
  • Added material design Seekbar and ImageButton widgets.
  • Updated the ImageView widget to support the tint feature.
  • Updated the look-and-feel of the SwitchCompat widget.
Changes for v7 mediarouter library:
  • Added the following features to the MediaRouteChooserDialog class:
    • Displays a loading page while discovering media route providers.
    • Includes a device type icon for easier device identification.
    • Sorts the routes according to frequency of use in the current app.
    • Supports landscape mode.
  • Added the following features to the MediaRouteControllerDialog class:
    • Recognizes screen casting and provides a proper description.
    • Supports various album art sizes and aspect ratios, and loads the art asynchronously.
    • Automatically selects the content color based on the primary color of the app.
    • Adjusts the dialog layout based on available screen space on the device.
    • Supports landscape mode.
Changes for v7 palette library:
  • Added the setRegion() method to support extracting color from a specific region of a Bitmap object.
Changes for v7 recyclerview library:
  • Added an improved animation API to the ItemAnimator class for better customizations:
    • Change animations no longer enforce two copies of the 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.
    • The new information record API gives the ItemAnimator class the flexibility to collect data at the correct point in the layout lifecycle. This information is later passed into the animate callbacks.
    • Provided an easy transition plan for this backward-incompatible API change:
      • If you’ve previously extended the 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.
      • Some methods were removed from the 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);
}
           
Changes for v7v14, and v17 Preference Support library:
  • Removed APIs for controlling EditText dialogs.
Changes for v17 Leanback Support library:
  • Added a version of the GuidedStepFragment class for the Support library (extends android.support.v4.app.Fragment), and improved animations and transitions.
  • Updated the GuidedStepFragment class so it can be placed on top of existing content.
  • Added the ability to annotate different types of search completions to the SearchFragment class.
  • Added staggered slide transition support to the VerticalGridFragment class.
Changes for Design Support library:
  • Added character counting support to the TextInputLayout widget.
  • Added edge snapping support to the 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.
  • Added support for custom views to the NavigationView class by using the app:actionLayout attribute or MenuItemCompat.setActionView()method.
Changes for Custom Tabs Support library:
  • Added the enableUrlBarHiding() method to the CustomTabsIntent class. It lets the client customize whether the URL bar should be hidden automatically on scroll down.
  • Added the setActionButton() method to the CustomTabsSession class. It lets the client change the icon for a custom action button in an already launched custom tab.
  • Added the TAB_SHOWN and TAB_HIDDEN constants as new events for the onNavigationEvent method of the CustomTabsCallback class.

Revision 23.0.1


September 2015

Changes for v7 and v14 Preference Support library:
  • Added the material design layout and style files. (Issue 183376)
Changes for v7 appcompat library:
  • Fixed crash issues for the Fragment class by limiting the use of hardware layers to Android 4.1 (API level 16) and higher. (Issue 183896)
  • Fixed an issue where hardware buttons did not work when an activity had set the Toolbar class to act as the ActionBar by using the setSupportActionBar() method. (Issue 183334)
  • Updated the AppCompatDialogFragment class so it no longer throws the Windows feature must be requested before adding content error. (Issue 183186)
Changes for Design Support library:
Changes for Custom Tabs Support library:

Revision 23


August 2015

Added new support libraries:

For a complete list of the Support Library changes, see the Support Library API Differences Report.

Revision 22.2.1


July 2015

Changes for Design Support library:
  • Added the hide() and show() methods to the FloatingActionButton class for programmatic triggering of animations.
  • Added the 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.
  • Added the getSelectedTabPosition() method to the TabLayout class for retrieving the currently selected tab.
  • Provided a fully fluent API for the android.support.v7.app.NotificationCompat.MediaStyle class for method chaining.
  • Added convenience methods to the RecyclerView for batch insertion of items.

For a complete list of the Support Library changes, see the Support Library API Differences Report.

Revision 22.2.0


May 2015

Added Design Support library:
  • Added TextInputLayout for showing EditText hint and error text as floating labels.
  • Added FloatingActionButton for implementing a primary action on your interface as a floating action button, supporting either default or mini sizes.
  • Added Snackbar for providing lightweight feedback with an optional action in an animated snackbar.
  • Added TabLayout for implementing fixed and scrollable tabs as well as easy integration with ViewPager.
  • Added NavigationView for implementing navigation drawer contents, including the ability to inflate menu items via a Menu Resource.
  • Added 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.
  • Added 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.
  • Added 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.
Changes for v4 support library:
Changes for v7 appcompat library:

For a complete list of the Support Library changes, see the Support Library API Differences Report.

Revision 22.1.0


April 2015

Changes for annotations library:
  • Added the Annotations library to provide support for enhanced code inspections. Annotations are added as metadata tags that you attach to variables, parameters, and return values to inspect method return values, passed parameters, and local variables and fields.
Changes for v4 support library:
Changes for v7 appcompat library:
Changes for v17 leanback library:
Changes for v7 recyclerview library:
Changes for v8 renderscript library:

Revision 22


March 2015

Changes for v4 support library:
Changes for v7 appcompat library:
Changes for v17 leanback library:
Changes for v7 mediarouter library:
Changes for v7 recyclerview library:

Revision 21.0.3


December 2014

Changes for v4 support library:

Revision 21.0.2


November 2014

Changes for v4 support library:
Changes for v7 appcompat library:
  • Added the PopupMenu constructor to support new popup menus.
  • Added support for a Collapse icon description in the Toolbar class.
  • Updated the SearchView widget to support displaying the commitIcon.
  • Removed the buttonGravity attribute from the Toolbar class.
Changes for v7 cardview library:
Changes for v7 recyclerview library:
Changes for v17 leanback library:
  • Added support to generate v4 code fragments.
  • Changed the secondary text color on CardView.

Revision 21.0.1


November 2014

Added multidex support library to support multiple Dalvik Executable (DEX) files for multi-dex file support prior to Android 5.0.

Revision 21


October 2014

Changes for v4 support library:
  • Added support for 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.
  • Added 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.
Changes for v7 appcompat library:
  • Added support for material design user interfaces.
  • Added Toolbar, which generalizes the functionality of ActionBar for use within app layouts.
  • Updated ActionBarDrawerToggle, which contains the menu-to-arrow animation
  • Updated common user interface widgets to allow tinting via theme attributes when running on pre-Android 5.0 devices
  • Added SwitchCompat, a backport of the Switch widget that was added in Android 4.0 (API level 14).
New v7 cardview library:
  • Added the CardView widget, which provides a material design-compatible implementation for displaying data items.
New v7 recyclerview library:
  • Added the RecyclerView widget, which provides a flexible list view for providing a limited window into a large data set.
New v7 palette library:
  • Added Palette class, which lets you extract prominent colors from an image.
New v17 leanback library:

Revision 20


July 2014

Changes for v4 support library:

Revision 19.1.0


March 2014

Changes for v4 support library:
  • Added the SwipeRefreshLayout class, which enables users to refresh the contents of a view with a vertical swipe gesture.
  • Fixed accessibility issues with navigation drawers.
Changes for v7 appcompat library:
  • Fixed background issues with the action bar.

Revision 19.0.1


December 2013

Changes for v4 support library:
Changes for v7 mediarouter library:
Changes for v8 renderscript library
  • Added error propagation for the RenderScript thunking layer.

Revision 19


October 2013

Changes for v4 support library:
Changes for v7 mediarouter library:
  • Added support for media playback queuing, setting HTTP header values and media playback duration.
  • Added explicit start, get, and end session actions for explicitly managing media playback sessions with media router.

Revision 18


July 2013

Changes for v4 support library:
  • User interface
    • Added BidiFormatter for handling text strings that combine right to left and left to right-formatted text.
    • Modified ViewPager to better handle cases where the pager has a measured width of zero in the initial layout processing.
    • Modified DrawerLayout and SlidingPaneLayout to not throw exceptions for measurement while the project code is being edited.
  • Accessibility
  • Media
    • Added TransportMediator helper class to manage media transport control, such as play, pause, skip and other media actions.
    • Added DisplayManagerCompat for managing display output to one or more device displays.
  • Other changes
New v7 appcompat library:
  • Added 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.
New v7 mediarouter library:

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.

Revision 13


May 2013

Changes for v4 support library:
New v7 gridlayout library:
  • Added GridLayout to provide support for the GridLayout layout object.
  • Added android.support.v7.widget.Space which can be used to create blank areas within a GridLayout layout object.

Revision 12


February 2013

Changes for v4 support library:
  • Improved interaction behavior for ViewPager.
  • Fixed a bug that could cause ViewPager to select the wrong page.
  • Fixed use of removeView() method during layout for ViewPager.
  • Fixed issue with 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.

Revision 11


November 2012

Changes for v4 support library:

Revision 10


August 2012

Changes for v4 support library:
  • Added support for notification features introduced in Android 4.1 (API level 16) with additions to NotificationCompat.

Revision 9


June 2012

Changes for v4 support library:

Revision 8


April 2012

Changes for v4 support library:
  • Fixed intent flags for PendingIntent objects generated by TaskStackBuilder.
  • Removed unused attributes from the gridlayout library projects to make sure the library can be built with API level 7 and higher.
  • Added .classpath and .project files for the gridlayout library project.

Revision 7


March 2012

Changes for v4 support library:
  • Added 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.
  • Added 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).
  • Added NotificationCompat.Builder to provide a compatibility implementation of Android 3.0's Notification.Builder helper class for creating standardized system notifications.

Revision 6


December 2011

Note: Reference for support library APIs are now available with the framework references, for example: android.support.v4.app.

Changes for v4 support library:
  • Changes to ViewPager:
    • Added extra decorative view support for ViewPager. Decorative views may be supplied as child views of a pager in XML layout.
    • Added PagerAdapter.getPageTitle() to supply title strings for pages, which defaults to no title for each page.
    • Added 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.
    • Updated PagerAdapter methods to take ViewGroup objects, rather than View to avoid class casting in adapter implementations.
    • Updated ViewPager to use Launcher-style fling behavior.
    • Bug fixes for user interface interaction and test automation.
  • Support for Fragments:
    • Changed setStartDeferred() method to setUserVisibleHint(boolean).
    • Added deferred start for off-screen pages to improve performance.
  • Support for Accessiblity APIs:

Revision 5


December 2011

Changes for v4 support library:

Revision 4


October 2011

Changes for v4 support library:
  • Added EdgeEffectCompat to support EdgeEffect.
  • Added LocalBroadcastManager to allow applications to easily register for and receive intents within a single application without broadcasting them globally.
  • Added support in ViewCompat to check for and set overscroll modes for Views on Android 2.3 and later.
  • Changes to Fragment APIs:
    • Added new APIs to control the visibility of new menus.
    • Added custom animation APIs.
    • Added APIs in FragmentActivity to retain custom, non-configuration instance data.
    • Various bug fixes.
  • Fixed a Loader bug that caused issues in canceling AsyncTasks 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.

Revision 3


July 2011

Changes for v4 support library:
  • Adds support for Fragment.SavedState
  • Adds MotionEventCompat to support newer MotionEvent APIs
  • Adds VelocityTrackerCompat to support a newer VelocityTracker APIs
  • Adds ViewConfigurationCompat to support a newer ViewConfiguration APIs
  • All new APIs (available only in the support library) that allow you to create UIs with horizontal paging, allowing users to swipe left and right between content views. Classes to support this include:
    • ViewPager: 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.
New v13 support library:
  • Includes the 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).

Revision 2


May 2011

Changes for v4 library:

Revision 1


March 2011

Initial release with the v4 library.

posted @ 2017-12-20 17:31  huyang011  阅读(2700)  评论(0编辑  收藏  举报