We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2d55746 commit 7a382dbCopy full SHA for 7a382db
ChaosCrystal/为ActionBar添加返回按钮.md
@@ -0,0 +1,21 @@
1
+# 为 ActionBar 添加返回按钮
2
+
3
+在 AndroidManifest.xml 文件中配置
4
5
+``` xml
6
+<activity android:name="com.gcssloop.test.viewsupport.TestCustomViewActivity"
7
+ android:parentActivityName="com.gcssloop.test.MainActivity">
8
+ <!-- 支持 4.0 以下的设备 -->
9
+ <meta-data
10
+ android:name="android.support.PARENT_ACTIVITY"
11
+ android:value="com.gcssloop.test.MainActivity" />
12
+</activity>
13
+```
14
+在 onCrate 中设置
15
16
17
+// 3.0+
18
+getSupportActionBar().setDisplayHomeAsUpEnabled(true);
19
+// If your minSdkVersion is 11 or higher, instead use:
20
+// getActionBar().setDisplayHomeAsUpEnabled(true);
21
0 commit comments