What is the best way to add a badge icon (Circle with a number in it) to a button's drawable?
The drawable is just an image. I was hoping there would be a way to change what I am using as the buttons drawable, and perhaps set it to another drawable that has my image in the middle with a shape on the top right. I will need to update the text of the shape programatically.
Here is my button now:
<Button
android:id="@+id/SpecialsMenuButton"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:textColor="#FFFFFF"
android:text="@string/specials_tab_title"
android:background="@drawable/menu_button"
android:padding="4dp"
android:drawableBottom="@drawable/collections_labels"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_weight="1" />
I also created a circle badge:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid
android:color="#F00" />
<stroke
android:width="2dip"
android:color="#FFF" />
<padding
android:left="5dip"
android:right="5dip"
android:top="5dip"
android:bottom="5dip" />
</shape>
I want to as easily as possible replace the android:drawableBottom
with something that will have my image with the shape in the top right corner of the image. Will I be able to do this as a drawable or will I have to do this outside of the button?
Thanks!