Constants

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

public static final 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

public static final 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

MODE_NIGHT_AUTO_BATTERY

public static final int MODE_NIGHT_AUTO_BATTERY

Night mode which uses a dark mode when the system's 'Battery Saver' feature is enabled,
otherwise it uses a 'light mode'. This mode can help the device to decrease power usage,
depending on the display technology in the device.
Please note: this mode should only be used when running on devices which do not
provide a similar device-wide setting.

MODE_NIGHT_AUTO_TIME

This constant is deprecated.
Automatic switching of dark/light based on the current time is deprecated.
Considering using an explicit setting, or MODE_NIGHT_AUTO_BATTERY.

Night mode which switches between dark and light mode depending on the time of day
(dark at night, light in the day).

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.

Constant Value:
0
(0x00000000)

MODE_NIGHT_FOLLOW_SYSTEM

public static final int MODE_NIGHT_FOLLOW_SYSTEM

Mode which uses the system's night mode setting to determine if it is night or not.

MODE_NIGHT_UNSPECIFIED

public static final int MODE_NIGHT_UNSPECIFIED

An unspecified mode for night mode. This is primarily used with
setLocalNightMode(int), to allow the default night mode to be used.
If both the default and local night modes are set to this value, then the default value of
MODE_NIGHT_FOLLOW_SYSTEM is applied.

setCompatVectorFromResourcesEnabled

Sets whether vector drawables on older platforms (< API 21) can be used within
DrawableContainer resources.

When enabled, AppCompat can intercept some drawable inflation from the framework, which
enables implicit inflation of vector drawables within
DrawableContainer resources. You can then use those
drawables in places such as android:src on ImageView,
or android:drawableLeft on TextView. Example usage:

This feature defaults to disabled, since enabling it can cause issues with memory usage,
and problems updating Configuration instances. If you update the configuration
manually, then you probably do not want to enable this. You have been warned.

Even with this disabled, you can still use vector resources through
AppCompatImageView.setImageResource(int) and its
app:srcCompat attribute. They can also be used in anything which AppCompat inflates
for you, such as menu resources.

Please note: this only takes effect in Activities created after this call.

setDefaultNightMode

Sets the default night mode. This is the default value used for all components, but can
be overridden locally via setLocalNightMode(int).

This is the primary method to control the DayNight functionality, since it allows
the delegates to avoid unnecessary recreations when possible.

If this method is called after any host components with attached
AppCompatDelegates have been 'started', a uiMode configuration change
will occur in each. This may result in those components being recreated, depending
on their manifest configuration.

setSupportActionBar

When set to a non-null value the getSupportActionBar() ()} method will return
an ActionBar object that can be used to control the given toolbar as if it were
a traditional window decor action bar. The toolbar's menu will be populated with the
Activity's options menu and the navigation button will be wired through the standard
home menu select action.

In order to use a Toolbar within the Activity's window content the application
must not request the window feature
FEATURE_SUPPORT_ACTION_BAR.

Parameters

toolbar

Toolbar: Toolbar to set as the Activity's action bar, or null to clear it

setTheme

public void setTheme (int themeResId)

This should be called from Activity.setTheme(int) to notify AppCompat of what
the current theme resource id is.