Sunday, July 10, 2016

Basic Drawable Vector Android

These are the basic commands for drawing drawable in Android :
  • M = moveto
  • L = lineto
  • H = horizontal lineto
  • V = vertical lineto
  • C = curveto
  • S = smooth curveto
  • Q = quadratic Bézier curve
  • T = smooth quadratic Bézier curveto
  • A = elliptical Arc
  • Z = closepath
So let's create a new drawable vector on androd. Right click on drawable folder, choose "new" then "drawable resource file" :
We're going to have a new file like this :
aaand... let's try to make a triangle first... :D :D :D
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:height="34dp"
    android:width="34dp"
    android:viewportHeight="340"
    android:viewportWidth="340"
    >
    <path
        android:fillColor="#FF0000"
        android:pathData="M150,0 L75,200 L225,200 Z"
        />

</vector>
Sooo... As you might notice from pathData. The first step is we moved to point 150,0 {M150,0}, Then drawing a line to point 75,200 {L75,200} and the last we drawed line to 225,200 {L225,200}. We finally closed the path by putting Z at the end. We don't really need this Z btw... :D But it just a sign that this is the end of the path...:D

So...If we want to draw a start using just L command, the code should be looking like this :
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:height="34dp"
    android:width="34dp"
    android:viewportHeight="340"
    android:viewportWidth="340"
    >
    <path
        android:fillColor="#90FF0F"
        android:pathData="M150,0 L75,200 L245,75 L55,75 L225,200 Z"
        />

</vector>
Okieee...That's all for Part I

Continue to Part II...

Saturday, July 9, 2016

Hinata Snapshots - Boruto - Naruto the Movie