The second Android 11 Developer Preview is now available, test it out and share your feedback.

ThemeCompat

class ThemeCompat
kotlin.Any
   ↳ androidx.core.content.res.ResourcesCompat.ThemeCompat

Provides backward-compatible implementations for new Theme APIs.

Summary

Public methods

static Unit
rebase(@NonNull theme: Theme)

Rebases the theme against the parent Resource object's current configuration by re-applying the styles passed to Theme#applyStyle(int, boolean).

Public methods

rebase

static fun rebase(@NonNull theme: Theme): Unit

Rebases the theme against the parent Resource object's current configuration by re-applying the styles passed to Theme#applyStyle(int, boolean).

Compatibility behavior:

  • API 29 and above, this method matches platform behavior.
  • API 23 through 28, this method attempts to match platform behavior by calling into hidden platform APIs, but is not guaranteed to succeed.
  • API 22 and earlier, this method does nothing.
Parameters
theme Theme: the theme to rebase