How to have badge icon at corner of a layout
<p>I wanted to have a badge at corner of a layout . I managed to get badge inside the layout but not able to achieve at corner of it . </p>

<p>Currently my code gives me :</p>

<p><a href="https://i.stack.imgur.com/uwWu6.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/uwWu6.jpg" alt="enter image description here"></a></p>

<p><strong>What i want :</strong> i want to have this badge to over right top corner of an layout . </p>

<p><strong>I want something like this :</strong> </p>

<p><a href="https://i.stack.imgur.com/2oVJH.png" rel="noreferrer"><img src="https://i.stack.imgur.com/2oVJH.png" alt="enter image description here"></a></p>

<p><strong>Toolbar.xml</strong></p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="@dimen/toolbar_height"
    android:background="@color/toolbar_color"
    android:contentInsetLeft="0dp"
    android:contentInsetStart="0dp"
    android:elevation="4dp"
    android:theme="@style/ThemeOverlay.AppCompat.Dark"
    app:contentInsetLeft="0dp"
    app:contentInsetStart="0dp"&gt;
    &lt;LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:weightSum="1"
        android:orientation="horizontal"&gt;

        &lt;TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/textview"
            android:text="My Assignments"
            android:layout_gravity="center"
            android:gravity="center"
            android:layout_marginLeft="90dp"
            android:layout_weight="0.5"
            android:textSize="20sp"
            /&gt;

        &lt;RelativeLayout
        android:id="@+id/bell_linearlayout1"
        android:layout_width="35dp"
        android:layout_height="35dp"
        android:layout_gravity="center"
        android:layout_marginLeft="15dp"&gt;

        &lt;RelativeLayout
            android:id="@+id/bell_linearlayout"
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:layout_gravity="center"
            android:background="#75aadb"&gt;
            &lt;ImageView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="2dp"
                android:layout_centerInParent="true"
                android:id="@+id/cartIconImageView"
                android:src="@drawable/notification"/&gt;
        &lt;/RelativeLayout&gt;

        &lt;RelativeLayout
            android:layout_width="25dip"
            android:layout_height="25dip"
            android:gravity="end|top|right"
            android:layout_alignParentTop="true"
            android:layout_marginBottom="100dp"
            android:layout_marginLeft="20dp"&gt;

            &lt;TextView
                android:id="@+id/textView1"
                android:layout_width="15dp"
                android:layout_height="15dp"
                android:layout_alignParentTop="true"
                android:background="@drawable/badge" /&gt;
        &lt;/RelativeLayout&gt;

&lt;/RelativeLayout&gt;
        &lt;LinearLayout
            android:layout_width="35dp"
            android:layout_height="35dp"
            android:background="#75aadb"
            android:id="@+id/accountinfo_layout"
            android:layout_gravity="center"
            android:layout_marginLeft="10dp"&gt;
            &lt;ImageView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="1dp"
                android:src="@drawable/profile"/&gt;

        &lt;/LinearLayout&gt;


    &lt;/LinearLayout&gt;
    &lt;/android.support.v7.widget.Toolbar&gt;
</code></pre>

<p><strong>Drawable badge.xml</strong></p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle"&gt;
    &lt;corners android:radius="8dp" /&gt;
    &lt;solid android:color="#f20000" /&gt;
    &lt;stroke
        android:width="2dip"
        android:color="#FFF" /&gt;
    &lt;padding
        android:bottom="6dp"
        android:left="6dp"
        android:right="6dp"
        android:top="6dp" /&gt;
&lt;/shape&gt;
</code></pre>

<p>Please help . </p>