AppCompatDelegate
This class represents a delegate which you can use to extend AppCompat's support to any android.app.Activity.
When using an AppCompatDelegate, you should call the following methods instead of the android.app.Activity method of the same name:
- addContentView
- setContentView
- setContentView
- setContentView
- requestWindowFeature
- hasWindowFeature
- invalidateOptionsMenu
- startSupportActionMode
- setSupportActionBar
- getSupportActionBar
- getMenuInflater
- findViewById
The following methods should be called from the android.app.Activity method of the same name:
- onCreate
- onPostCreate
- onConfigurationChanged
- onStart
- onStop
- onPostResume
- onSaveInstanceState
- setTitle
- onStop
- onDestroy
An Activity can only be linked with one AppCompatDelegate instance, therefore the instance returned from create should be retained until the Activity is destroyed.
Types
Link copied to clipboard
Properties
Link copied to clipboard
Flag for specifying the behavior of action modes when an Action Bar is not present.
Link copied to clipboard
Flag for enabling the support Action Bar.
Link copied to clipboard
Flag for requesting an support Action Bar that overlays window content.
Link copied to clipboard
Link copied to clipboard
Night mode which uses a dark mode when the system's 'Battery Saver' feature is enabled, otherwise it uses a 'light mode'.
Link copied to clipboard
Night mode which switches between dark and light mode depending on the time of day (dark at night, light in the day).
Link copied to clipboard
Mode which uses the system's night mode setting to determine if it is night or not.
Link copied to clipboard
Night mode which uses always uses a light mode, enabling
notnight
qualified resources regardless of the time.Link copied to clipboard
An unspecified mode for night mode.
Link copied to clipboard
Night mode which uses always uses a dark mode, enabling
night
qualified resources regardless of the time.Functions
Link copied to clipboard
Should be called instead of addContentView}
Link copied to clipboard
Applies the currently selected night mode to this delegate's host component.
Link copied to clipboard
Link copied to clipboard
Should be called from attachBaseContext.
Link copied to clipboard
@NonNull
Create an androidx.appcompat.app.AppCompatDelegate to use with
activity
.@NonNull
Create an androidx.appcompat.app.AppCompatDelegate to use with
dialog
.@NonNull
@NonNull
Link copied to clipboard
abstract fun createView(@Nullable parent: @Nullable View, name: String, @NonNull context: @NonNull Context, @NonNull attrs: @NonNull AttributeSet): View
This should be called from a LayoutInflater.Factory2 in order to return tint-aware widgets.
Link copied to clipboard
Link copied to clipboard
Returns application locales for the calling app as a LocaleListCompat.
Link copied to clipboard
Returns the context for the current delegate.
Link copied to clipboard
Returns the default night mode.
Link copied to clipboard
Returns an ActionBarDrawerToggle.Delegate which can be returned from your Activity if it implements ActionBarDrawerToggle.DelegateProvider.
Link copied to clipboard
Returns the night mode previously set via getLocalNightMode.
Link copied to clipboard
Return the value of this call from your getMenuInflater
Link copied to clipboard
Support library version of getActionBar.
Link copied to clipboard
Query for the availability of a certain feature.
Link copied to clipboard
Installs AppCompat's android.view.LayoutInflater Factory so that it can replace the framework widgets with compatible tinted versions.
Link copied to clipboard
Should be called from invalidateOptionsMenu} or supportInvalidateOptionsMenu.
Link copied to clipboard
Returns whether vector drawables on older platforms (< API 21) can be accessed from within resources.
Link copied to clipboard
Returns whether AppCompat handles any native action modes itself.
Link copied to clipboard
Should be called from onConfigurationChanged
Link copied to clipboard
Should be called from onPostCreate
Link copied to clipboard
Should be called from onPostResume
Link copied to clipboard
Allows AppCompat to save instance state.
Link copied to clipboard
Should be called from Activity.onStop()
Link copied to clipboard
Enable extended window features.
Link copied to clipboard
Sets the current locales for the calling app.
Link copied to clipboard
Sets whether vector drawables on older platforms (< API 21) can be used within android.graphics.drawable.DrawableContainer resources.
Link copied to clipboard
Should be called instead of setContentView}
Link copied to clipboard
Sets the default night mode.
Link copied to clipboard
Whether AppCompat handles any native action modes itself.
Link copied to clipboard
Override the night mode used for this delegate's host component.
Link copied to clipboard
Sets the OnBackInvokedDispatcher for handling system back for Android SDK 33 and above.
Link copied to clipboard
Link copied to clipboard
Should be called from onTitleChanged}
Link copied to clipboard
@Nullable
Start an action mode.