共用方式為


Activity.OnConfigurationChanged(Configuration) Method

Definition

Called by the system when the device configuration changes while your activity is running.

[Android.Runtime.Register("onConfigurationChanged", "(Landroid/content/res/Configuration;)V", "GetOnConfigurationChanged_Landroid_content_res_Configuration_Handler")]
public virtual void OnConfigurationChanged (Android.Content.Res.Configuration newConfig);
[<Android.Runtime.Register("onConfigurationChanged", "(Landroid/content/res/Configuration;)V", "GetOnConfigurationChanged_Landroid_content_res_Configuration_Handler")>]
abstract member OnConfigurationChanged : Android.Content.Res.Configuration -> unit
override this.OnConfigurationChanged : Android.Content.Res.Configuration -> unit

Parameters

newConfig
Configuration

The new device configuration.

Implements

Attributes

Remarks

Called by the system when the device configuration changes while your activity is running. Note that this will <em>only</em> be called if you have selected configurations you would like to handle with the android.R.attr#configChanges attribute in your manifest. If any configuration change occurs that is not selected to be reported by that attribute, then instead of reporting it the system will stop and restart the activity (to have it launched with the new configuration).

At the time that this function has been called, your Resources object will have been updated to return resource values matching the new configuration.

Java documentation for android.app.Activity.onConfigurationChanged(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