经常需要在一个图片上面显示一个气泡,在气泡上面显示消息的数量。这里提供一种方法,直接设置textview的背景色,并且设置textview的文本信息。
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_launcher"
tools:context=".MainActivity" >
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|bottom"
android:layout_marginLeft="40dip"
android:background="@drawable/red_circle"
android:gravity="center"
android:text="1"
android:textSize="12dip" />
实现效果:
相关文章