Appcompat

Allows access to new APIs on older API versions of the platform (many using Material Design).
Latest Update Current Stable Release Next Release Candidate Beta Release Alpha Release
July 21, 2021 1.3.1 - - 1.4.0-alpha03

Declaring dependencies

To add a dependency on Appcompat, you must add the Google Maven repository to your project. Read Google's Maven repository for more information.

Add the dependencies for the artifacts you need in the build.gradle file for your app or module:

Groovy

dependencies {
    def appcompat_version = "1.3.1"

    implementation "androidx.appcompat:appcompat:$appcompat_version"
    // For loading and tinting drawables on older versions of the platform
    implementation "androidx.appcompat:appcompat-resources:$appcompat_version"
}

Kotlin

dependencies {
    val appcompat_version = "1.3.1"

    implementation("androidx.appcompat:appcompat:$appcompat_version")
    // For loading and tinting drawables on older versions of the platform
    implementation("androidx.appcompat:appcompat-resources:$appcompat_version")
}

For more information about dependencies, see Add Build Dependencies.

Feedback

Your feedback helps make Jetpack better. Let us know if you discover new issues or have ideas for improving this library. Please take a look at the existing issues in this library before you create a new one. You can add your vote to an existing issue by clicking the star button.

Create a new issue

See the Issue Tracker documentation for more information.

Version 1.4.0

Version 1.4.0-alpha03

June 30, 2021

androidx.appcompat:appcompat:1.4.0-alpha03 and androidx.appcompat:appcompat-resources:1.4.0-alpha03 are released. Version 1.4.0-alpha03 contains these commits.

New Features

  • Library is now targeting Java 8 language level
  • Add emoji2 support for more TextView subclasses (AppCompatMultiAutoCompleteTextView, AppCompatAutoCompleteTextView, AppCompatRadioButton, AppCompatCheckBox).

API Changes

  • Added an API to configure an InputConnection to use View.performReceiveContent to handle IME calls to InputConnection.commitContent. (I3a2ad)
  • Add support for EmojiCompat to AppCompatMultiAutoCompleteTextView (Ifece0)
  • Add support for EmojiCompat to AppCompatAutoCompleteTextView (Ia1f4b)
  • Add support for EmojiCompat to AppCompatRadioButton (If08af)
  • Add support for EmojiCompat to AppCompatCheckBox (I2b3bc)
  • Allow null KeyListener in AppCompatEditText. This reverses the non-null annotation that was added to AppCompatEditText in 1.4-alpha01 and restores the previous behavior when passed null. (I21482, b/189559345)
  • Add PopupMenu.setForceShowIcon for parity with platform APIs (I43bb3, b/182789798)

Bug Fixes

  • Fix bug in AppCompatEditText that will reset the inputType specified in XML to remove variations. This bug was introduced in AppCompat 1.4.0-alpha01. (I9df36, b/191061070)

Version 1.4.0-alpha02

June 2, 2021

androidx.appcompat:appcompat:1.4.0-alpha02 and androidx.appcompat:appcompat-resources:1.4.0-alpha02 are released. Version 1.4.0-alpha02 contains these commits.

API Changes

  • Added AppCompatDialogFragment constructor that takes a layout ID (Icbf22, b/188119987)
  • Improved layout inspector support (I02d55)
  • Renamed package in emoji2-views-helper to androidx.emoji2.viewsintegration. This is a breaking change for AppCompat 1.4.0-alpha01, and apps must ensure AppCompat dependency is updated to use the new emoji2 version. (Ie8397)

Bug Fixes

  • Fixed issue where stopped activities did not receive configuration changes from AppCompat-instrumented night mode changes. (I8fa8f, b/188681415)
  • Fixed bug in AppCompatEditText which would cause views to be focusable even when android:focusable="false" was specified in the xml (bug introduced in AppCompat 1.4.0-alpha01) (Ib9412)

Version 1.4.0-alpha01

May 18, 2021

androidx.appcompat:appcompat:1.4.0-alpha01 and androidx.appcompat:appcompat-resources:1.4.0-alpha01 are released. Version 1.4.0-alpha01 contains these commits.

API Changes

  • Integrated EmojiCompat support to a variety of AppCompat widgets (Id409b, If7a1a, Ic262d, Ib5f4a, I4fb3c)
  • Added support for nested tinted resources and vector drawables in AppCompat resource loading backports. Note, however, that this means apps cannot override getDrawable() on a custom Resources object when backports are enabled. (Ia6b03, b/176129022)
  • Improved layout inspector support (I6d771)

Bug Fixes

  • Fixed a scenario where calling setSupportActionBar after setting the window callback would overwrite the callback. (Ie43ee, b/186791590)
  • Added a workaround for an issue on SDKs 29 and 30 where ColorStateListDrawable resources cloned from the drawable cache don't load a default color until they receive a state change. (Iedb4b)
  • Avoid NPE when handling null custom selection action mode callbacks on AppCompat-backed views. (I033c7, b/173435375)

Dependency Updates

External Contribution

  • Backport tintable background and check mark for CheckedTextView (I8575c)

Version 1.3.1

Version 1.3.1

July 21, 2021

androidx.appcompat:appcompat:1.3.1 and androidx.appcompat:appcompat-resources:1.3.1 are released. Version 1.3.1 contains these commits.

Dependency updates

Version 1.3.0

Version 1.3.0

May 18, 2021

androidx.appcompat:appcompat:1.3.0 and androidx.appcompat:appcompat-resources:1.3.0 are released. Version 1.3.0 contains these commits.

Important changes since 1.2.0

  • Fixed propagation of android:theme attributes across <include>d layouts on pre-Lollipop devices
  • Reduced library size by converting many PNG resources to VectorDrawables
  • Added support for drag-and-drop events to AppCompatEditText with OnReceiveContentListener
  • Updated to support changes to Android 11 window inset handling
  • Added support for RTL in menu items with icons
  • Added support for inserting rich content (ex. pasting an image) in AppCompatEditText

  • Updated dependencies: appcompat updated many of its transitive dependencies to support new functionality and fixes:

Version 1.3.0-rc01

March 24, 2021

androidx.appcompat:appcompat:1.3.0-rc01 and androidx.appcompat:appcompat-resources:1.3.0-rc01 are released. Version 1.3.0-rc01 contains these commits.

Bug Fixes

  • Prevents permissions from being revoked prematurely when handling IME content insertion

Dependency Updates

External Contribution

  • Fixed propagation of android:theme attribute across <include>d layouts on pre-Lollipop devices (Simon Bergner at Opera)

Version 1.3.0-beta01

January 13, 2021

androidx.appcompat:appcompat:1.3.0-beta01 and androidx.appcompat:appcompat-resources:1.3.0-beta01 are released. Version 1.3.0-beta01 contains these commits.

New Features

  • Theme-level action mode drawables have been replaced with vector sources. This may cause slight changes in the visual appearance of individual icons. (I741a6)

API Changes

  • Integrated drag-and-drop (drop events) in AppCompatEditText with OnReceiveContentListener. (Ib26c9, b/175343405)
  • Updated OnReceiveContentListener and related APIs. See androidx.core library changes for more details. (Ib4616, b/173814913)
  • Moved widget.RichContentReceiverCompat to view.OnReceiveContentListener. (Ifdab7, b/173814913)
  • APIs to supply and retrieve initial surrounding text have been backported to EditorInfoCompat. They allow IME apps to avoid additional IPC latency. (Ie3809)

Version 1.3.0-alpha02

August 19, 2020

androidx.appcompat:appcompat:1.3.0-alpha02 and androidx.appcompat:appcompat-resources:1.3.0-alpha02 are released. Version 1.3.0-alpha02 contains these commits.

Bug Fixes

  • AppCompatRatingBar PNG drawables have been replaced with vector sources. This may cause slight changes in the visual appearance of individual stars. (I6b99d)
  • Update WindowInsetsCompat to Android 11 APIs (I3df9e)
  • Support RTL in menu items with icons (I2f5c5)

Dependency Updates

  • AppCompat has updated its dependency from Fragment 1.1.0 to Fragment 1.3.0-alpha08. It is strongly recommended to read through the Fragment 1.2.0 release notes to understand the major changes introduced in the previous Fragment release.
  • AppCompat has updated its dependency from Activity 1.0.0 to Activity 1.2.0-alpha08. It is strongly recommended to read through the Activity 1.1.0 release notes to understand the major changes introduced in the previous Activity release.
    • AppCompatActivity now uses the OnContextAvailableListener API introduced in Activity 1.2.0-alpha08 to set up the AppCompatDelegate. Any listeners added to subclasses of AppCompatActivity will run after this listener. (I513da)

Version 1.3.0-alpha01

May 20, 2020

androidx.appcompat:appcompat:1.3.0-alpha01 and androidx.appcompat:appcompat-resources:1.3.0-alpha01 are released. Version 1.3.0-alpha01 contains these commits.

New Features

  • Add a new Lint rule to flag calls to setActionBar on activities that extend AppCompatActivity
  • Added support for ViewTreeLifecycleOwner from Lifecycle 2.3.0-alpha01, ViewTreeViewModelStoreOwner from Lifecycle 2.3.0-alpha03, and ViewTreeSavedStateRegistryOwner from SavedState 1.1.0-alpha01 when using a View within an AppCompatActivity. (b/151603528, aosp/1300264)
  • Add common API for inserting rich content (e.g. pasting an image). The new callback provides a single API that apps can implement to support the different ways in which rich content may be inserted. For now the API is only added to AppCompatEditText and will be invoked for the following code paths:
    • paste from the clipboard
    • content insertion from the IME (InputConnection.commitContent) (I22bf7)

Bug Fixes

  • From AppCompat 1.2.0-rc01: AppCompat no longer calls onMenuOpened() with a null menu. (b/142843126)
  • Correctly resolve text link and hint colors on older devices when TextViewCompat.setTextAppearance is called with a text appearance style that has color state lists that reference theme color attributes (b/154702995)

Version 1.2.0

Version 1.2.0

August 5, 2020

androidx.appcompat:appcompat:1.2.0 and androidx.appcompat:appcompat-resources:1.2.0 are released. Version 1.2.0 contains these commits.

Major changes since 1.1.0

  • Fixed support for Configuration override use cases, including custom locales and font scales. See here for an example of how to correctly implement overrides using appcompat:1.2.0.
  • Deprecated AppCompatDelegate.attachBaseContext(). If you are calling or overriding this method, use AppCompatDelegate.attachBaseContext2() instead.
  • Deprecated CollapsibleActionView. This interface is no longer needed, use the platform-provided android.view.CollapsibleActionView interface.

Version 1.2.0-rc02

July 22, 2020

androidx.appcompat:appcompat:1.2.0-rc02 and androidx.appcompat:appcompat-resources:1.2.0-rc02 are released. Version 1.2.0-rc02 contains these commits.

Bug Fixes

  • Fixed an issue related to night mode where calling AppCompatDelegate.setDefaultNightMode from a dialog would occasionally fail to recreate activities and apply the new mode. (aosp/1348308, b/158923881)

Version 1.2.0-rc01

May 14, 2020

androidx.appcompat:appcompat:1.2.0-rc01 and androidx.appcompat:appcompat-resources:1.2.0-rc01 are released. Version 1.2.0-rc01 contains these commits.

API Changes

  • AppCompatDelegate.setLocalNightMode has been marked as requiring SDK version 17 or higher due to a platform issue with configuration changes leaking between Activities on earlier SDKs

Bug Fixes

  • AppCompatDelegate.setLocalNightMode may now be called prior to Activity.attachBaseContext
  • Fixed ActionBarOverlayLayout inset consumption which was incorrectly using the cached insets
  • AppCompat no longer calls onMenuOpened() with a null menu. (b/142843126)

Version 1.2.0-beta01

April 1, 2020

androidx.appcompat:appcompat:1.2.0-beta01 and androidx.appcompat:appcompat-resources:1.2.0-beta01 are released. Version 1.2.0-beta01 contains these commits.

New Features

  • Added the following new lint rules that will flag incorrect usages of AppCompat in the following scenarios:
    • Loading color state lists: suggests using ContextCompat and AppCompatResources APIs for backward compatibility
    • Loading drawables: suggests using ContextCompat and ResourcesCompat APIs for backward compatibility
    • Using color state lists with alpha attribute: flags missing android:alpha attribute that will lead to incorrect appearance on some platform versions
    • Tinting image views: flags not using app:tint that will lead to incorrect appearance on older platform versions
    • Using compound drawables and tinting on text views: suggests using compat attributes and APIs for backward compatibility

Bug Fixes

  • Fixed an issue where ActionBarOverlayLayout (window decor action) was not dispatching WindowInsets correctly.
  • Fixed issues in tinting drawables and text appearance on older versions of the platform
  • Fixed an issue where androidx.appcompat:appcompat:1.1.0 crashes webview when webview is long pressed (b/141351441)
  • Implemented fixes for issues with base context manipulation and retrieving system services during activity start up

Version 1.2.0-alpha03

March 4, 2020

androidx.appcompat:appcompat:1.2.0-alpha03 and androidx.appcompat:appcompat-resources:1.2.0-alpha03 are released. Version 1.2.0-alpha03 contains these commits.

Bug Fixes

  • Fixed an issue where the action mode status guard mistakenly extends into the navigation bar and has the wrong color (Ia4a09)
  • Fix issue where stopped Activities were not resuming on API Level 23 and below (I45201)

Version 1.2.0-alpha02

January 29, 2020

androidx.appcompat:appcompat:1.2.0-alpha02 and androidx.appcompat:appcompat-resources:1.2.0-alpha02 are released. Version 1.2.0-alpha02 contains these commits.

Bug fixes

  • Fixed issue where appcompat 1.1.0 crashes webview when long pressed (b/141351441)
  • Fixed drawable tinting on TextView relative to compound drawables on API Level 23 (aosp/1172194)
  • Ensured the base context is always a wrapper (aosp/1194355)
  • Added some improvements to be more clever when modifying the base context configuration (aosp/1204543)
  • Disabled createConfigurationContext() for Robolectric (aosp/1186218)

Version 1.2.0-alpha01

December 4, 2019

androidx.appcompat:appcompat:1.2.0-alpha01 and androidx.appcompat:appcompat-resources:1.2.0-alpha01 are released. Version 1.2.0-alpha01 contains these commits.

Bug fixes

  • Calls to PackageManager.getActivityInfo don't crash anymore under strict mode with boot-aware checks enabled
  • Fixes for tinting drawables on AppCompatButton
  • Fixes for tinting and text appearance on older versions of the platform

Version 1.1.0

Version 1.1.0

September 5, 2019

androidx.appcompat:appcompat:1.1.0 and androidx.appcompat:appcompat-resources:1.1.0 are released. The commits included in this version can be found here.

Important changes since 1.0.0

  • Dark Mode Improvements: MODE_NIGHT_AUTO and switching of dark/light based on the current time is now deprecated. Considering using an explicit setting, or MODE_NIGHT_AUTO_BATTERY.
  • Activity 1.0: AppCompatActivity now transitively extends from ComponentActivity from Activity 1.0.0 via Fragment 1.1.0. See the associated release notes for information on the changes in each library.
  • AppCompatActivity LayoutId constructor: Subclasses of AppCompatActivity can now optionally call into a constructor on AppCompatActivity that takes an R.layout ID, indicating the layout that should be set as the content view as an alternative to calling setContentView() in onCreate(). This does not change the requirement that your subclass have a no-argument constructor.

Version 1.1.0-rc01

July 2, 2019

androidx.appcompat:appcompat:1.1.0-rc01 and androidx.appcompat:appcompat-resources:1.1.0-rc01 are released. The commits included in this version can be found here.

Bug fixes

  • DayNight now honors configChanges correctly (aosp/981105)
  • Only call onConfigurationChanged on started Activities (aosp/987483)

Version 1.1.0-beta01

June 5, 2019

androidx.appcompat:appcompat:1.1.0-beta01 and androidx.appcompat:appcompat-resources:1.1.0-beta01 are released. The commits included in this version can be found here.

Bug fixes

  • Make sure we clean up receivers in AppCompatDialogs (aosp/959376)
  • Add support for buttonGravity=center_vertical on Toolbar (b/130361721)
  • Fix spinner horizontal offset (b/79477181)

Version 1.1.0-alpha05

May 7, 2019

androidx.appcompat:appcompat:1.1.0-alpha05 and androidx.appcompat:appcompat-resources:1.1.0-alpha05 are released. The commits included in this version can be found here.

New features

Bug fixes

  • Various fixes to DayNight mode
  • Invalidate outline on any background change in ActionBar
  • Fix spinner widget scroll
  • Fix custom set window backgrounds being overridden in AlertDialog

Version 1.1.0-alpha04

April 3, 2019

androidx.appcompat:appcompat:1.1.0-alpha04 and androidx.appcompat:appcompat-resources:1.1.0-alpha04 are released. The commits included in this version can be found here.

New features

  • Added new ThemeOverlay.AppCompat.DayNight family of themes. These should be used when using the DayNight feature.

API changes

  • AppCompatActivity now contain a second constructor that takes a @LayoutRes int, which replaces the previous behavior of annotating your AppCompatActivity class with @ContentView. This approach works in both app and library modules. (b/128352521)

Bug fixes

  • Pinned internal dependencies to stable versions where possible
  • Fixed AppCompatSpinnerscrolling in dropdown mode )b/124274573)
  • Only calls applyOverrideConfiguration() if required for DayNight

Version 1.1.0-alpha03

March 13, 2019

androidx.appcompat:appcompat:1.1.0-alpha03 and androidx.appcompat:appcompat-resources:1.1.0-alpha03are released. This is the first release of appcompat-resources. The full list of commits included in this version can be found here.

New features

  • The new appcompat-resources library contains APIs that allow apps to load and tint drawables (including vector drawables) on older versions of the platform. This is the same functionality that was previously part of the appcompat module, but is now available without the overhead of the full appcompat backport of Material design that includes widgets, dialogs, night mode etc.
  • Major fixes to DayNight mode support
  • New MODE_NIGHT_AUTO_BATTERY option for DayNight mode
  • Drawable tinting in AppCompatTextView
  • Toolbar overflow can now be styled with themed color state lists
  • Menu icons can now use colors that reference theme attributes
  • The new app:menu attribute can be set on a Toolbar to provide the menu content at inflation time

Bug fixes

  • Fixed default tint mode on ImageView on version 21
  • Fixed spinner popup incorrect dismissal on device rotation
  • Fixed DayNight does not respect configChanges in manifest
  • Fixed switching to MODE_NIGHT_FOLLOW_SYSTEM doesn't work (b/111345020)
  • Fixed WebView resets DayNight Resources (b/37124582)

Version 1.1.0-alpha02

February 7, 2019

androidx.appcompat:appcompat 1.1.0-alpha02 is released.

New features

  • Extracted resource-specific drawable handling into a hook (aosp/870976)
  • Allowed Toolbar titleTextColor and subtitleTextColor to use a ColorStateList and added ColorStateList overloads of the setTitleTextColor and setSubtitleTextColor methods (aosp/867489)

Bug fixes

  • Fixed fontFamily not working on pre API 24 (aosp/807054)
  • Fixed bug where textFontWeight did not work when an activity extends from AppCompatActivity (aosp/847640)
  • Fixed bug that caused the title text on the spinner widget popup (when using dialog mode) to not use the font specified in the fontFamily (aosp/789994)
  • Fix bug that prevented widgets AppCompatCheckBox and AppCompatRadioButton from be able to change the background tint (aosp/825160)
  • Fixed bug where AppCompat did not override android: list styles (aosp/862350)

Version 1.1.0-alpha01

December 3, 2018

New features

  • AppCompatTextView now supports app:drawableLeftCompat, app:drawableTopCompat, app:drawableRightCompat, app:drawableBottomCompat, app:drawableStartCompat and app:drawableEndCompat compound drawables, supporting backported drawable types such as VectorDrawableCompat.

  • AppCompatCheckBox and AppCompatRadioButton’s default drawables now animate check state changes.

API changes

  • aosp/740385: ActionBarOverlayLayout now implements NestedScrollingParent2 and NestedScrollingParent3, enabling it to facilitate the latest functionality in nested scrolling 3. If developer code currently overrides ActionBarOverLayLayout.onNestedScroll(View, int, int, int, int), it will likely no longer be called and ActionBarOverLayLayout.onNestedScroll(View, int, int, int, int, int, int[]) should be overridden instead.

Version 1.0.2

Version 1.0.2

November 7, 2018

Bugfix release of core-1.0.1 and appcompat-1.0.2.

Bug fixes

  • Fixed bug where PrecomputedTextCompat would crash when used with RTL AppCompatTextView. b/113070424

Version 1.0.0

Version 1.0.0

November 7, 2018

New features