I am trying to insert Text on the image top right. Something like this:
So I tried the following: custom_profile_image here is 50dp
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/layoutforprofileimage"
android:layout_width="@dimen/custom_profile_image"
android:layout_height="@dimen/custom_profile_image">
<ImageView
android:id="@+id/image"
android:layout_width="@dimen/custom_profile_image"
android:padding="2dp"
android:src="@drawable/profilepic"
android:layout_height="@dimen/custom_profile_image" />
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="@id/image"
android:layout_alignTop="@id/image"
android:scaleType="fitStart"
android:layout_marginRight="0dp"
android:padding="2dp"
android:background="@drawable/number_round"
android:gravity="center"
android:minWidth="17sp"
android:adjustViewBounds="true"
android:minHeight="17sp"
android:paddingBottom="1dp"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:text="0"
android:textColor="#ffffffff"
android:textSize="12sp"
android:visibility="visible"
tools:ignore="RtlHardcoded" />
</RelativeLayout>
For the above XML I am getting the following output:
The problem here is that I would like to move the orange box towards the top so that it touches the tip of a profile image similar to the screenshot above. I tried lots of things, but not able to do so.
I am not sure what to do. Can you somebody help me with this?
Thanks!