Skip to content

Commit 6603a7b

Browse files
authored
法则-创立
1 parent 7127d7f commit 6603a7b

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Activity结束情况
2+
3+
## 1.正常结束
4+
5+
应用程序退出或者调用`finish()`方法正常结束的Activity。
6+
7+
## 2.系统配置改变导致Activity被销毁并重建
8+
9+
如手机旋转屏幕,弹出键盘等导致Activity销毁并重建。
10+
11+
如果想避免这种情况,可以在`AndroidManifest.xml`文件中为Activity进行配置,如下:
12+
13+
```
14+
<activity
15+
android:name=".TestActivity"
16+
android:configChanges="keyboardHidden|orientation">
17+
</activity>
18+
```
19+
20+
> 屏蔽了键盘状态改变和屏幕方向改变导致Activity销毁并重建。
21+
22+
可配置属性有很多,想要配置多个属性可以用 `|` 连接起来。
23+
24+
属性 | 摘要
25+
-------------------|------------------------------------------------
26+
mcc | SIM卡唯一标识码IMSI(国际移动用户识别码)中等国家代码发生改变,由三位数组成,中国为460。
27+
mnc | SIM卡唯一标识码IMSI(国际移动用户识别码)中等运营商代码发生改变,由两位数组成,中国移动为00,中国连通为01,中国电信为03。
28+
locale | 设备本地位置发生改变,一般指切换了系统语言。
29+
touchscreen | 触摸屏发生改变(通常不会发生,可以忽略)。
30+
keyboard |
31+
keyboardHidden |
32+
navigation |
33+
screenLayout |
34+
fontScale |
35+
uiMode |
36+
orientation |
37+
screenSize |
38+
smallestScreenSize |
39+
layoutDirection |
40+
41+
42+
43+
44+
45+

0 commit comments

Comments
 (0)