I want to design the following UI. Can anybody give me an example or suggest some source code for implementation?
相关问题
- 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
If you want to set up the notification icon on the top-left corner it is as simple as the next piece of code:
Bitmap1 must be bigger than bitmap2, and in your case I would advise it to be a PNG image with transparent background to allow the notification bubble be outside the rest of the image.
Otherwise if you want it on the right-top corner you should try any of the others specifications for Canvas.drawBitmap.
For example:
Try doing something like:
If all you wanted was how to do it on XML, then you should create a RelativeLayout and then on it add both images and align the notification bubble to the right. And that should do the trick. You would've still have to have a PNG image with the transparent background.
I hope that would be enough for what you want to do.
You can use a RelativeLayout with two children, one for the icon and one for the badge. The icon needs extra padding so that the badge is slightly outside of it. The badge is positioned aligned with parentTop and parentRight.
Here is Project on Git Hub regarding showing badges on different items, but inside your application (i.e
TextView
,TabHost
,ImageView
etc)About showing the badge on application icon, this is not possible, because this is not android way of showing notifications. The android framework supports handling notifications using Status bar Notifications
here is a simple library available support in multiple devices like sony,samsung,moto etc...try this...this will work...i tried and is working fine... http://github.com/leolin310148/ShortcutBadger
Here is your source code for this app widget icon badge count display.
and also you need this badge_count2.xml drawable file.