Google is committed to advancing racial equity for Black communities. See how.

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 22, 2020 1.1.0 1.2.0-rc02 - 1.3.0-alpha01

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:

dependencies {
    def appcompat_version = "1.1.0"

    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. Please 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.3.0

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