Message shape in android using xml.

Step 1:- Write this code in message.xml file that place in drawable folder. 

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="#df2b" />
</shape>
</item>
<item>
<rotate
android:fromDegrees="45"
android:pivotX="135%"
android:pivotY="15%"
android:toDegrees="45">
<shape android:shape="rectangle">
<solid android:color="#5037" />
</shape>
</rotate>
</item>
</layer-list>



Step 2:- Write this code in main.xml file that place in layout folder. 

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#efef"
android:gravity="center">

<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@drawable/message"
tools:ignore="ContentDescription" />
</LinearLayout>



Step 3:- Enjoy...

Meta Tag:- android app development, message layout, message using xml, material design, UI/UX.

Comments