Skip to content

Latest commit

 

History

History
36 lines (24 loc) · 1.5 KB

README.markdown

File metadata and controls

36 lines (24 loc) · 1.5 KB

Android ViewBadger

A simple way to "badge" any given Android view at runtime without having to cater for it in layout.

Demos  ListAdapter  Layout Tests

Note: If your aim is to replicate the iOS icon and TabBar badge UI for notifications, consider using Android UI conventions such as the number field of the Notification class rather than this method.

Usage

Simple example:

View target = findViewById(R.id.target_view);
BadgeView badge = new BadgeView(this, target);
badge.setText("1");
badge.show();

This project contains a fully working example application. Refer to the DemoActivity class for more custom badge examples, including custom backgrounds and animations. BadgeView is a subclass of TextView so you can use all of TextView's methods to style the appearance of your badge.

Implementation

To use ViewBadger in your own Android project, simply copy android-viewbadger.jar (available from this repository's package downloads) into your project's /libs directory and add it to the build path.

Credits

Author: Jeff Gilfelt

The code in this project is licensed under the Apache Software License 2.0.
Copyright (c) 2011 readyState Software Ltd.