I would like to do this kind of button with a triangle in the right-top corner of a layout :
I've started this layout without this triangle yet:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="48dp"
android:gravity="center_vertical"
android:paddingLeft="@dimen/keyline_1"
android:paddingRight="@dimen/keyline_2">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/grey"
android:text="DESCRIPTION"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentRight="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="@dimen/keyline_4"
android:textColor="@color/grey"
android:text="info"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/grey"
android:text="TITLE"/>
</LinearLayout>
</RelativeLayout>
Use below code to create triangle shape and make it textview background
and use below code to rotate the textview
more detail refer How to make custom textview in android?
You've to create a
shape
and add it as abackground
like this one :Add a
TextView
and put thisshape
as abackground
and change thegravity
toend
Example :
Also if you don't familiar with
shapes
try this answer