AppCompatDelegate
abstract class AppCompatDelegate
kotlin.Any | |
↳ | androidx.appcompat.app.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(android.view.View, android.view.ViewGroup.LayoutParams)
setContentView(int)
setContentView(android.view.View)
setContentView(android.view.View, android.view.ViewGroup.LayoutParams)
requestWindowFeature(int)
hasWindowFeature(int)
invalidateOptionsMenu()
startSupportActionMode(androidx.appcompat.view.ActionMode.Callback)
setSupportActionBar(androidx.appcompat.widget.Toolbar)
getSupportActionBar()
getMenuInflater()
findViewById(int)
The following methods should be called from the android.app.Activity
method of the same name:
onCreate(android.os.Bundle)
onPostCreate(android.os.Bundle)
onConfigurationChanged(android.content.res.Configuration)
onStart()
onStop()
onPostResume()
onSaveInstanceState(Bundle)
setTitle(CharSequence)
onStop()
onDestroy()
An Activity
can only be linked with one AppCompatDelegate
instance, therefore the instance returned from create(Activity, AppCompatCallback)
should be retained until the Activity is destroyed.
Summary
Constants | |
---|---|
static Int |
Flag for specifying the behavior of action modes when an Action Bar is not present. |
static Int |
Flag for enabling the support Action Bar. |
static Int |
Flag for requesting an support Action Bar that overlays window content. |
static Int | |
static Int |
Night mode which uses a dark mode when the system's 'Battery Saver' feature is enabled, otherwise it uses a 'light mode'. |
static Int |
Night mode which switches between dark and light mode depending on the time of day (dark at night, light in the day). |
static Int |
Mode which uses the system's night mode setting to determine if it is night or not. |
static Int |
Night mode which uses always uses a light mode, enabling |
static Int |
An unspecified mode for night mode. |
static Int |
Night mode which uses always uses a dark mode, enabling |
Public methods | |
---|---|
abstract Unit |
addContentView(v: View!, lp: LayoutParams!) Should be called instead of |
abstract Boolean |
Applies the currently selected night mode to this delegate's host component. |
open Unit |
attachBaseContext(context: Context!) |
open Context |
attachBaseContext2(@NonNull context: Context) Should be called from Activity#attachBaseContext(Context). |
open static AppCompatDelegate |
create(@NonNull activity: Activity, @Nullable callback: AppCompatCallback?) Create an |
open static AppCompatDelegate |
create(@NonNull dialog: Dialog, @Nullable callback: AppCompatCallback?) Create an |
open static AppCompatDelegate |
create(@NonNull context: Context, @NonNull window: Window, @Nullable callback: AppCompatCallback?) Create an |
open static AppCompatDelegate |
create(@NonNull context: Context, @NonNull activity: Activity, @Nullable callback: AppCompatCallback?) Create an |
abstract View! |
createView(@Nullable parent: View?, name: String!, @NonNull context: Context, @NonNull attrs: AttributeSet) This should be called from a |
abstract T? |
findViewById(@IdRes id: Int) Finds a view that was identified by the id attribute from the XML that was processed in |
open static Int |
Returns the default night mode. |
abstract ActionBarDrawerToggle.Delegate? |