-
Android) 뒤로가기 아이콘 생성Android Studio 2020. 4. 14. 10:20
manifests > AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.bmicalculator"> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".ResultActivity" android:parentActivityName=".MainActivity" /> </application> </manifest>
두번째 액티비티에 parentActivityName 속성으로 액티비티간의 상하 관계를 설정할 수 있음.
앱을 실행하게 되면,
맨 처음 MainActivity 가 뜨고, 이후 ResultActivity 를 띄웠을 때, 툴바에 뒤로가기 아이콘이 표시되고뒤로가기 아이콘을 클릭하면 이전 액티비티로 이동함.
'Android Studio' 카테고리의 다른 글
안드로이드 | 타이틀 바 없애기, 풀스크린 (0) 2018.05.12 안드로이드 | 카카오 API 해시 값 얻어오기 (0) 2018.05.10