📜  android 祖传导航 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:25.515000             🧑  作者: Mango

代码示例1
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
  int itemId = item.getItemId();
  if (itemId == android.R.id.home) {
    // force up navigation to have the same behavior as temporal navigation
    onBackPressed();
    return true;
  } else {
    return super.onOptionsItemSelected(item);
  }
}