public class ContextThemeWrapper
extends android.content.ContextWrapper
ACCESSIBILITY_SERVICE, ACCOUNT_SERVICE, ACTIVITY_SERVICE, ALARM_SERVICE, APP_OPS_SERVICE, APPWIDGET_SERVICE, AUDIO_SERVICE, BATTERY_SERVICE, BIND_ABOVE_CLIENT, BIND_ADJUST_WITH_ACTIVITY, BIND_ALLOW_OOM_MANAGEMENT, BIND_AUTO_CREATE, BIND_DEBUG_UNBIND, BIND_EXTERNAL_SERVICE, BIND_IMPORTANT, BIND_NOT_FOREGROUND, BIND_WAIVE_PRIORITY, BLUETOOTH_SERVICE, CAMERA_SERVICE, CAPTIONING_SERVICE, CARRIER_CONFIG_SERVICE, CLIPBOARD_SERVICE, COMPANION_DEVICE_SERVICE, CONNECTIVITY_SERVICE, CONSUMER_IR_SERVICE, CONTEXT_IGNORE_SECURITY, CONTEXT_INCLUDE_CODE, CONTEXT_RESTRICTED, CROSS_PROFILE_APPS_SERVICE, DEVICE_POLICY_SERVICE, DISPLAY_SERVICE, DOWNLOAD_SERVICE, DROPBOX_SERVICE, EUICC_SERVICE, FINGERPRINT_SERVICE, HARDWARE_PROPERTIES_SERVICE, INPUT_METHOD_SERVICE, INPUT_SERVICE, IPSEC_SERVICE, JOB_SCHEDULER_SERVICE, KEYGUARD_SERVICE, LAUNCHER_APPS_SERVICE, LAYOUT_INFLATER_SERVICE, LOCATION_SERVICE, MEDIA_PROJECTION_SERVICE, MEDIA_ROUTER_SERVICE, MEDIA_SESSION_SERVICE, MIDI_SERVICE, MODE_APPEND, MODE_ENABLE_WRITE_AHEAD_LOGGING, MODE_MULTI_PROCESS, MODE_NO_LOCALIZED_COLLATORS, MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE, NETWORK_STATS_SERVICE, NFC_SERVICE, NOTIFICATION_SERVICE, NSD_SERVICE, POWER_SERVICE, PRINT_SERVICE, RECEIVER_VISIBLE_TO_INSTANT_APPS, RESTRICTIONS_SERVICE, SEARCH_SERVICE, SENSOR_SERVICE, SHORTCUT_SERVICE, STORAGE_SERVICE, STORAGE_STATS_SERVICE, SYSTEM_HEALTH_SERVICE, TELECOM_SERVICE, TELEPHONY_SERVICE, TELEPHONY_SUBSCRIPTION_SERVICE, TEXT_CLASSIFICATION_SERVICE, TEXT_SERVICES_MANAGER_SERVICE, TV_INPUT_SERVICE, UI_MODE_SERVICE, USAGE_STATS_SERVICE, USB_SERVICE, USER_SERVICE, VIBRATOR_SERVICE, WALLPAPER_SERVICE, WIFI_AWARE_SERVICE, WIFI_P2P_SERVICE, WIFI_RTT_RANGING_SERVICE, WIFI_SERVICE, WINDOW_SERVICE| 构造器和说明 |
|---|
ContextThemeWrapper()
Creates a new context wrapper with no theme and no base context.
|
ContextThemeWrapper(android.content.Context base,
int themeResId)
Creates a new context wrapper with the specified theme.
|
ContextThemeWrapper(android.content.Context base,
android.content.res.Resources.Theme theme)
Creates a new context wrapper with the specified theme.
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
applyOverrideConfiguration(android.content.res.Configuration overrideConfiguration)
Call to set an "override configuration" on this context -- this is
a configuration that replies one or more values of the standard
configuration that is applied to the context.
|
protected void |
attachBaseContext(android.content.Context newBase) |
android.content.res.AssetManager |
getAssets() |
android.content.res.Resources |
getResources() |
java.lang.Object |
getSystemService(java.lang.String name) |
android.content.res.Resources.Theme |
getTheme() |
int |
getThemeResId()
Returns the resource ID of the theme that is to be applied on top of the base context's
theme.
|
protected void |
onApplyThemeResource(android.content.res.Resources.Theme theme,
int resid,
boolean first)
Called by
setTheme(int) and getTheme() to apply a theme
resource to the current Theme object. |
void |
setTheme(int resid) |
bindService, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingPermission, checkCallingUriPermission, checkPermission, checkSelfPermission, checkUriPermission, checkUriPermission, clearWallpaper, createConfigurationContext, createContextForSplit, createDeviceProtectedStorageContext, createDisplayContext, createPackageContext, databaseList, deleteDatabase, deleteFile, deleteSharedPreferences, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, enforceUriPermission, fileList, getApplicationContext, getApplicationInfo, getBaseContext, getCacheDir, getClassLoader, getCodeCacheDir, getContentResolver, getDatabasePath, getDataDir, getDir, getExternalCacheDir, getExternalCacheDirs, getExternalFilesDir, getExternalFilesDirs, getExternalMediaDirs, getFilesDir, getFileStreamPath, getMainExecutor, getMainLooper, getNoBackupFilesDir, getObbDir, getObbDirs, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getSharedPreferences, getSystemServiceName, getWallpaper, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, grantUriPermission, isDeviceProtectedStorage, isRestricted, moveDatabaseFrom, moveSharedPreferencesFrom, openFileInput, openFileOutput, openOrCreateDatabase, openOrCreateDatabase, peekWallpaper, registerReceiver, registerReceiver, registerReceiver, registerReceiver, removeStickyBroadcast, removeStickyBroadcastAsUser, revokeUriPermission, revokeUriPermission, sendBroadcast, sendBroadcast, sendBroadcastAsUser, sendBroadcastAsUser, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcastAsUser, sendStickyBroadcast, sendStickyBroadcastAsUser, sendStickyOrderedBroadcast, sendStickyOrderedBroadcastAsUser, setWallpaper, setWallpaper, startActivities, startActivities, startActivity, startActivity, startForegroundService, startInstrumentation, startIntentSender, startIntentSender, startService, stopService, unbindService, unregisterReceiverpublic ContextThemeWrapper()
Note: A base context must be attached
using attachBaseContext(Context) before calling any other
method on the newly constructed context wrapper.
public ContextThemeWrapper(android.content.Context base,
int themeResId)
The specified theme will be applied on top of the base context's theme. Any attributes not explicitly defined in the theme identified by themeResId will retain their original values.
base - the base contextthemeResId - the resource ID of the theme to be applied on top of
the base context's themepublic ContextThemeWrapper(android.content.Context base,
android.content.res.Resources.Theme theme)
Unlike ContextThemeWrapper(Context, int), the theme passed to
this constructor will completely replace the base context's theme.
base - the base contexttheme - the theme against which resources should be inflatedprotected void attachBaseContext(android.content.Context newBase)
attachBaseContext 在类中 android.content.ContextWrapperpublic void applyOverrideConfiguration(android.content.res.Configuration overrideConfiguration)
Context.createConfigurationContext(Configuration) for more
information.
This method can only be called once, and must be called before any
calls to getResources() or getAssets() are made.
public android.content.res.Resources getResources()
getResources 在类中 android.content.ContextWrapperpublic void setTheme(int resid)
setTheme 在类中 android.content.ContextWrapperpublic int getThemeResId()
public android.content.res.Resources.Theme getTheme()
getTheme 在类中 android.content.ContextWrapperpublic java.lang.Object getSystemService(java.lang.String name)
getSystemService 在类中 android.content.ContextWrapperprotected void onApplyThemeResource(android.content.res.Resources.Theme theme,
int resid,
boolean first)
setTheme(int) and getTheme() to apply a theme
resource to the current Theme object. Can override to change the
default (simple) behavior. This method will not be called in multiple
threads simultaneously.theme - The Theme object being modified.resid - The theme style resource being applied to theme.first - Set to true if this is the first time a style is being
applied to theme.public android.content.res.AssetManager getAssets()
getAssets 在类中 android.content.ContextWrapper