Is there any way to draw a one-sided triangle in a rectangle in Android XML. Like this image below...
Asked
Active
Viewed 1,498 times
3
-
Try creating a SVG . Then use it as VectorDrawable https://stackoverflow.com/questions/30923205/easiest-way-to-use-svg-in-android. – ADM Mar 14 '19 at 08:19
3 Answers
0
You can use vector drawable like this
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="200dp"
android:height="200dp"
android:viewportWidth="200"
android:viewportHeight="200">
<path
android:fillColor="#ffffff"
android:pathData="M7.5 131.61L138.5 128.88L187.87 97.48L138.5 67.2L7.5 67.2L7.5 131.61Z" />
<path
android:fillColor="#000000"
android:fillAlpha="0"
android:strokeColor="#152dbe"
android:strokeWidth="3"
android:pathData="M7.5 131.61L138.5 128.88L187.87 97.48L138.5 67.2L7.5 67.2L7.5 131.61Z" />

Adil
- 812
- 1
- 9
- 29
-
-
if you want to know in detail how i create this vector you can check my recent answers in which way i follow to create vector – Adil Mar 14 '19 at 09:55
0
to do this you can use vector
<vector android:height="24dp"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@color/white" android:pathData="M0,0 H17 L23 5 L17 10 H0 V0 "
android:strokeColor="@color/color_blue"
android:strokeWidth="1"/>
</vector>

Phantômaxx
- 37,901
- 21
- 84
- 115

Farido mastr
- 464
- 5
- 12
0
This is for your reference only.
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="1365dp"
android:height="1024dp"
android:viewportHeight="1024"
android:viewportWidth="1365">
<path
android:fillColor="#1296db"
android:pathData="M1236.4080406 442.12695338l-164.79492238-263.67187551A131.83593775 131.83593775 0 0 0 959.88216119 116.4921875H333.66145857a131.83593775 131.83593775 0 0 0-131.83593775 131.83593775v527.3437495a131.83593775 131.83593775 0 0 0 131.83593775 131.83593775h626.22070262a131.83593775 131.83593775 0 0 0 111.73095703-61.96289037l164.79492238-263.67187551a131.83593775 131.83593775 0 0 0 0-139.74609324z m-56.03027394 104.80957031l-164.79492162 263.67187475A65.9179685 65.9179685 0 0 1 959.88216119 841.589844H333.66145857a65.9179685 65.9179685 0 0 1-65.91796925-65.91796925V248.32812525a65.9179685 65.9179685 0 0 1 65.91796925-65.91796925h626.22070262a65.9179685 65.9179685 0 0 1 56.03027395 30.98144556l164.79492162 263.67187475a65.9179685 65.9179685 0 0 1 0 69.87304738z"/>
</vector>

PandaTure
- 1
- 2