Ad
Show Backbutton In Toolbar Using Styles
I would like to pass toolbar theme to my other library's class in AndroidManifest. I have declared the theme in styles.xml as follows:
<style name="MyTheme" parent="AppTheme">
<item name="homeAsUpIndicator">@drawable/back</item>
<item name="title">@string/app_name</item>
<item name="subtitle">@string/app_version</item>
</style>
Whereas, the back button is not visible while displaying that library's class. So is there a way to setDisplayHomeAsUpEnabled
to true in styles.xml
itself??
Ad
Answer
We can use, navigationIcon
option to show icon using styles.xml
.
If you're targetting API 21+,
<item name="android:navigationIcon">@drawable/back</item>
Otherwise,
<item name="navigationIcon">@drawable/back</item>
So, my theme should be,
<style name="MyTheme" parent="AppTheme">
<item name="colorPrimary">@color/colorAccent</item>
<item name="title">@string/app_name</item>
<item name="subtitle">@string/app_version</item>
<item name="navigationIcon">@drawable/back</item>
</style>
Ad
source: stackoverflow.com
Related Questions
- → should I choose reactjs+f7 or f7+vue.js?
- → Phonegap Android write to sd card
- → Local reference jquery script in nanohttpd (Android)
- → Click to navigate on mobile devices
- → How to allow api access to android or ios app only(laravel)?
- → Access the Camera and CameraRoll on Android using React Native?
- → React native change listening port
- → What is the default unit of style in React Native?
- → Google play market autocomplete icon
- → Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of `ListView`
- → Using Laravel with Genymotion
- → react native using like web-based ajax function
- → react native pdf View
Ad