반응형
ActionBar에 뒤로가기 버튼 추가하기
// onCreate 함수 안에 적어준다.
// 액션바에 뒤로가기 버튼 셋팅
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
// onCreate 함수 바깥에 onSupportNavigateUP함수를 추가해 준다.
@Override
public boolean onSupportNavigateUp() {
// 1. finish() 이용하는 방법
finish();
// 2. 기계의 백버튼 눌렀을때 호출되는 콜백함수를 이용하는 방법
// onBackPressed();
return true;
}
반응형
'TOOL > Android Studio' 카테고리의 다른 글
| Android Studio - 네트워크 통신을 위한 Volley 라이브러리 (0) | 2022.07.23 |
|---|---|
| Android Studio - 카메라, 앨범 처리 (0) | 2022.07.21 |
| Android Studio - ActionBar의 Title을 변경하는 방법 (0) | 2022.07.19 |
| Android Studio - SDK location not found Error (0) | 2022.07.15 |
| Android Studio - 다른 Activity로 class 객체 전달 방법 (0) | 2022.07.15 |