I just migrate from api 19 Kitkat to api 21 Lollipop. And now I have found that the app icon is not there on actionbar. I feel that my app looks kind of different. So is there any way to show the app icon.
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
Try this:-
I would also like to show my awesome app icon in Lollipop+, so here's what I used.
Source: ActionBar#setDisplayShowHomeEnabled(boolean)
This is how I did it:
Which will give you this:
In the Material theme (and AppCompat version 21 which is based on it), the Action Bar follows the material design guidelines and uses a Toolbar:
However, if you want an application icon, setLogo() is the correct method.
This worked for me -
It is important that you setDisplayOptions as setIcon/setLogo doesn't seem to be working without it. Original answer - App compat actionbar v21 app icon is not showing
This code worked on my device. Let me know if you have any additional questions.
you have to used toolbar in your app like below.
styles.xml
v21\styles.xml
in your layout use toolbar like this:
in your Java file write below code for set icon: