共用方式為


Context.CreateConfigurationContext(Configuration) Method

Definition

Return a new Context object for the current Context but whose resources are adjusted to match the given Configuration.

[Android.Runtime.Register("createConfigurationContext", "(Landroid/content/res/Configuration;)Landroid/content/Context;", "GetCreateConfigurationContext_Landroid_content_res_Configuration_Handler")]
public abstract Android.Content.Context? CreateConfigurationContext (Android.Content.Res.Configuration overrideConfiguration);
[<Android.Runtime.Register("createConfigurationContext", "(Landroid/content/res/Configuration;)Landroid/content/Context;", "GetCreateConfigurationContext_Landroid_content_res_Configuration_Handler")>]
abstract member CreateConfigurationContext : Android.Content.Res.Configuration -> Android.Content.Context

Parameters

overrideConfiguration
Configuration

A Configuration specifying what values to modify in the base Configuration of the original Context's resources. If the base configuration changes (such as due to an orientation change), the resources of this context will also change except for those that have been explicitly overridden with a value here.

Returns

A Context with the given configuration override.

Attributes

Remarks

Return a new Context object for the current Context but whose resources are adjusted to match the given Configuration. Each call to this method returns a new instance of a Context object; Context objects are not shared, however common state (ClassLoader, other Resources for the same configuration) may be so the Context itself can be fairly lightweight.

Java documentation for android.content.Context.createConfigurationContext(android.content.res.Configuration).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to