How to display the indicator bubble on top of the imageview?
android, android-layout
Solution
try this : create `layout.xml`
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/main_widget"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dip"
android:focusable="true" >
<ImageView
android:id="@+id/icon"
android:layout_width="60dip"
android:layout_height="60dip"
android:layout_marginTop="8dp"
android:background="@drawable/logo"
android:contentDescription="image"
android:scaleType="center" />
<TextView
android:id="@+id/txt_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="-10dip"
android:layout_toRightOf="@+id/icon"
android:background="@drawable/badge_count2"
android:contentDescription="badge"
android:gravity="center"
android:text="1"
android:textColor="@color/White"
android:textStyle="bold"
android:visibility="visible" />
</RelativeLayout>
And create `drawable\badge_count2.xml` for rectangle
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid android:color="@color/red" >
</solid>
<stroke
android:width="2dp"
android:color="#FFFFFF" >
</stroke>
<padding
android:bottom="2dp"
android:left="7dp"
android:right="7dp"
android:top="3dp" />
<corners android:radius="10dp" >
</corners>
And create `values\color.xml` and add:
<color name="red">#e50822</color>
OutPut:
Update: try to create `drawable\badge_count2.xml` for circle
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:innerRadius="0dp"
android:shape="ring"
android:thicknessRatio="1.9"
android:useLevel="false" >
<solid android:color="@color/red" />
<stroke
android:width="2dp"
android:color="#FFFFFF" />
</shape>
Problem
I have a string value (i.e.: numbers 1, 2, 3, ...) and I should display those on the top right corner of my ImageView. How can I do that in android? I have attached an image below in which I show arrows: I want something like that to display over my ImageView? Please anyone can help me out?