问题
I know we can set the following value to the android:configChanges
mcc
mnc
touchScreen
keyboardHidden
orientation,etc.
and sometimes we join them by this |
operator but i am very confused what is the meaning of them by joining them. What changes come..? Please clear my confusion.
and also how do u know that by using |
this operator what happens with the option?
回答1:
When a configuration change occurs at runtime, the activity is shut down and restarted by default, but declaring a configuration with these type attribute will prevent the activity from being restarted.
For Instance, When you declare the option(android:configChanges="orientation|keyboardHidden"
) in your Manifest file
"orientation"
, Declaring a configuration with this attribute will prevent the activity from being restarted.In other case,you are informing to the android system that you have separate layout that has to be drawn when the layout change happens.So your activity will remove all the references of the widgets and values stored previously and recreates with the layout file that is designed specifically for landscape, if any. All the values that are shown before the layout orientation happens can be saved and restored throughonSaveInstanceState
andonRestoreInstanceState
"keyboardHidden"
, Hides the keyboard
Hope, these points would help you a little at least.
I will try add more points on this topic.
Cheers
回答2:
When you join
mcc, mnc, touchScreen,keyboardHidden, orientation,etc.
by |
it actually considers all the parameters together.
Like the activity should not be affected when the mcc
changes or mnc
changes or the screen orientation
changes. Or the keyboard
pops in or out
Whichever parameters you add using |
will be considered.
mcc
The IMSI mobile country code (MCC) has changed — a SIM has been detected and updated the MCC.
mnc
The IMSI mobile network code (MNC) has changed — a SIM has been detected and updated the MNC.
touchscreen
The touchscreen has changed. (This should never normally happen.)
来源:https://stackoverflow.com/questions/13116603/androidconfigchanges-option-android