
activity actionbar with back arrow similar to android material design menu
You can add the following to your activity tag inside your manifest.xml file:
android:parentActivityName=".screens.MainActivity"
This will automatically place a back arrow inside your Activity and navigate to MainActivity when pressed.
Note This will only work in Android 4.1 or greater:
Beginning in Android 4.1 (API level 16), you can declare the logical parent of each activity by specifying the android:parentActivityName attribute in the element.
If your app targets Android 4.0 or before you should include the support library and add the following to your activity inside the manifest.xml:
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".screens.MainActivity" />
You will then need to allow Up navigation by adding this to your Activity:
getActionBar().setDisplayHomeAsUpEnabled(true);
For more information please see the Android docs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With