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 e571391 commit e7335daCopy full SHA for e7335da
ChaosCrystal/ActionBar/为ActionBar添加返回按钮.md
@@ -19,3 +19,19 @@ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
19
// If your minSdkVersion is 11 or higher, instead use:
20
// getActionBar().setDisplayHomeAsUpEnabled(true);
21
```
22
+监听返回按钮事件
23
+
24
+> 它的 id 是 home,可以使用重载 `onOptionsItemSelected` 的方式进行监听。
25
+``` java
26
+@Override
27
+public boolean onOptionsItemSelected(MenuItem item)
28
+{
29
+ // TODO Auto-generated method stub
30
+ if(item.getItemId() == android.R.id.home)
31
+ {
32
+ finish();
33
+ return true;
34
+ }
35
+ return super.onOptionsItemSelected(item);
36
+}
37
+```
0 commit comments