belongs to Maven artifact com.android.support:appcompat-v7:28.0.0-alpha1
AppCompatDelegate
public
abstract
class
AppCompatDelegate
extends Object
java.lang.Object | |
↳ | android.support.v7.app.AppCompatDelegate |
This class represents a delegate which you can use to extend AppCompat's support to any
Activity
.
When using an AppCompatDelegate
, you should call the following methods instead of the
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(android.support.v7.view.ActionMode.Callback)
setSupportActionBar(android.support.v7.widget.Toolbar)
getSupportActionBar()
getMenuInflater()
findViewById(int)
The following methods should be called from the 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 | |
---|---|
int |
FEATURE_ACTION_MODE_OVERLAY
Flag for specifying the behavior of action modes when an Action Bar is not present. |
int |
FEATURE_SUPPORT_ACTION_BAR
Flag for enabling the support Action Bar. |
int |
FEATURE_SUPPORT_ACTION_BAR_OVERLAY
Flag for requesting an support Action Bar that overlays window content. |
int |
MODE_NIGHT_AUTO
Mode which means to use night mode when it is determined that it is night or not. |
int |
MODE_NIGHT_FOLLOW_SYSTEM
Mode which uses the system's night mode setting to determine if it is night or not. |
int |
MODE_NIGHT_NO
Mode which means to not use night mode, and therefore prefer |
int |
MODE_NIGHT_YES
Mode which means to always use night mode, and therefore prefer |
Public methods | |
---|---|
abstract
void
|
addContentView(View v, ViewGroup.LayoutParams lp)
Should be called instead of
|
abstract
boolean
|
applyDayNight()
Allow AppCompat to apply the |
static
AppCompatDelegate
|
create(Dialog dialog, AppCompatCallback callback)
Create a |
static
AppCompatDelegate
|
create(Activity activity, AppCompatCallback callback)
Create a |
abstract
View
|
createView(View parent, String name, Context context, AttributeSet attrs)
This should be called from a
|
abstract
<T extends View>
T
|
findViewById(int id)
Finds a view that was identified by the id attribute from the XML that
was processed in |
static
int
|
getDefaultNightMode()
Returns the default night mode. |
abstract
ActionBarDrawerToggle.Delegate
|
getDrawerToggleDelegate()
Returns an |
abstract
MenuInflater
|
getMenuInflater()
Return the value of this call from your |
abstract
ActionBar
|
getSupportActionBar()
Support library version of |
abstract
boolean
|
hasWindowFeature(int featureId)
Query for the availability of a certain feature. |
abstract
void
|
installViewFactory()
Installs AppCompat's |
abstract
void
|
invalidateOptionsMenu()
Should be called from |
static
boolean
|
isCompatVectorFromResourcesEnabled()
Returns whether vector drawables on older platforms (< API 21) can be accessed from within resources. |
abstract
boolean
|
isHandleNativeActionModesEnabled()
Returns whether AppCompat handles any native action modes itself. |
abstract
void
|
onConfigurationChanged(Configuration newConfig)
Should be called from
|
abstract
void
|
onCreate(Bundle savedInstanceState)
Should be called from |
abstract
void
|
onDestroy()
Should be called from |
abstract
void
|
onPostCreate(Bundle savedInstanceState)
Should be called from |
abstract
void
|
onPostResume()
Should be called from |
abstract
void
|
onSaveInstanceState(Bundle outState)
Allows AppCompat to save instance state. |
abstract
void
|
onStart()
Should be called from |
abstract
void
|
onStop()
Should be called from |
abstract
boolean
|
requestWindowFeature(int featureId)
Enable extended window features. |
static
void
|
setCompatVectorFromResourcesEnabled(boolean enabled)
Sets whether vector drawables on older platforms (< API 21) can be used within
|
abstract
void
|
setContentView(View v)
Should be called instead of |
abstract
void
|
setContentView(int resId)
Should be called instead of |
abstract
void
|
setContentView(View v, ViewGroup.LayoutParams lp)
Should be called instead of
|
static
void
|
setDefaultNightMode(int mode)
Sets the default night mode. |
abstract
void
|
setHandleNativeActionModesEnabled(boolean enabled)
Whether AppCompat handles any native action modes itself. |
abstract
void
|
setLocalNightMode(int mode)
Override the night mode used for this delegate's host component. |
abstract
void
|
setSupportActionBar(Toolbar toolbar)
|
abstract
void
|
setTitle(CharSequence title)
Should be called from |
abstract
ActionMode
|
startSupportActionMode(ActionMode.Callback callback)
Start an action mode. |
Inherited methods | |
---|---|
![]()
java.lang.Object
|
Constants
FEATURE_ACTION_MODE_OVERLAY
int FEATURE_ACTION_MODE_OVERLAY
Flag for specifying the behavior of action modes when an Action Bar is not present. If overlay is enabled, the action mode UI will be allowed to cover existing window content.
Constant Value: 10 (0x0000000a)
FEATURE_SUPPORT_ACTION_BAR
int FEATURE_SUPPORT_ACTION_BAR
Flag for enabling the support Action Bar.
This is enabled by default for some devices. The Action Bar replaces the title bar and provides an alternate location for an on-screen menu button on some devices.
Constant Value: 108 (0x0000006c)
FEATURE_SUPPORT_ACTION_BAR_OVERLAY
int FEATURE_SUPPORT_ACTION_BAR_OVERLAY
Flag for requesting an support Action Bar that overlays window content.
Normally an Action Bar will sit in the space above window content, but if this
feature is requested along with FEATURE_SUPPORT_ACTION_BAR
it will be layered over
the window content itself. This is useful if you would like your app to have more control
over how the Action Bar is displayed, such as letting application content scroll beneath
an Action Bar with a transparent background or otherwise displaying a transparent/translucent
Action Bar over application content.
This mode is especially useful with View.SYSTEM_UI_FLAG_FULLSCREEN
, which allows
you to seamlessly hide the action bar in conjunction with other screen decorations.
When an ActionBar is in this mode it will adjust the insets provided to
View.fitSystemWindows(Rect)
to include the content covered by the action bar, so you can do layout within
that space.
Constant Value: 109 (0x0000006d)
MODE_NIGHT_AUTO
int MODE_NIGHT_AUTO
Mode which means to use night mode when it is determined that it is night or not.
The calculation used to determine whether it is night or not makes use of the location APIs (if this app has the necessary permissions). This allows us to generate accurate sunrise and sunset times. If this app does not have permission to access the location APIs then we use hardcoded times which will be less accurate.
See also:
Constant Value: 0 (0x00000000)
MODE_NIGHT_FOLLOW_SYSTEM
int MODE_NIGHT_FOLLOW_SYSTEM
Mode which uses the system's night mode setting to determine if it is night or not.
See also:
Constant Value: -1 (0xffffffff)
MODE_NIGHT_NO
int MODE_NIGHT_NO
Mode which means to not use night mode, and therefore prefer notnight
qualified
resources where available, regardless of the time.
See also:
Constant Value: 1 (0x00000001)
MODE_NIGHT_YES
int MODE_NIGHT_YES
Mode which means to always use night mode, and therefore prefer night
qualified
resources where available, regardless of the time.
See also:
Constant Value: 2 (0x00000002)