Thursday 28 December 2017

Animations

Animation 1 :

res/anim/

sample.xml

<?xml version="1.0" encoding="utf-8"?>
<scale xmlns:android="http://schemas.android.com/apk/res/android"
  android:interpolator="@android:anim/accelerate_decelerate_interpolator"
  android:duration="300"
  android:fillAfter="true"
  android:fromXScale="0.0"
  android:fromYScale="0.0"
  android:toXScale="1.0"
  android:toYScale="1.0" />

Animation 2 :

res/anim/

fad_in.xml

<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:fillAfter="true" >

    <alpha
        android:duration="1000"
        android:fromAlpha="0.0"
        android:interpolator="@android:anim/accelerate_interpolator"
        android:toAlpha="1.0" />

</set>

Animation 3 :

res/anim/

fad_out.xml

<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:fillAfter="true" >

    <alpha
        android:duration="1000"
        android:fromAlpha="1.0"
        android:interpolator="@android:anim/accelerate_interpolator"
        android:toAlpha="0.0" />

</set>

Animation 4 :

res/anim/

blink.xml

<set xmlns:android="http://schemas.android.com/apk/res/android">
    <alpha android:fromAlpha="0.0"
        android:toAlpha="1.0"
        android:interpolator="@android:anim/accelerate_interpolator"
        android:duration="600"
        android:repeatMode="reverse"
        android:repeatCount="infinite"/>
</set>

Animation 5 :

res/anim/

zoom_in.xml

<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:fillAfter="true" >

    <scale
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:duration="1000"
        android:fromXScale="1"
        android:fromYScale="1"
        android:pivotX="50%"
        android:pivotY="50%"
        android:toXScale="3"
        android:toYScale="3" >
    </scale>

</set>

Animation 6 :

res/anim/

zoom_out.xml

<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:fillAfter="true" >

    <scale
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:duration="1000"
        android:fromXScale="1.0"
        android:fromYScale="1.0"
        android:pivotX="50%"
        android:pivotY="50%"
        android:toXScale="0.5"
        android:toYScale="0.5" >
    </scale>

</set>

Animation 7 :

res/anim/

rotate.xml

<set xmlns:android="http://schemas.android.com/apk/res/android">
    <rotate android:fromDegrees="0"
        android:toDegrees="360"
        android:pivotX="50%"
        android:pivotY="50%"
        android:duration="600"
        android:repeatMode="restart"
        android:repeatCount="infinite"
        android:interpolator="@android:anim/cycle_interpolator"/>

</set>

Animation 8 :

res/anim/

moov.xml

<set
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:interpolator="@android:anim/linear_interpolator"
    android:fillAfter="true">

   <translate
        android:fromXDelta="0%p"
        android:toXDelta="75%p"
        android:duration="800" />
</set>

Animation 9 :

res/anim/

slide_up.xml

<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:fillAfter="true" >

    <scale
        android:duration="500"
        android:fromXScale="1.0"
        android:fromYScale="1.0"
        android:interpolator="@android:anim/linear_interpolator"
        android:toXScale="1.0"
        android:toYScale="0.0" />

</set>


Animation 10 :

res/anim/

slide_down.xml

<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:fillAfter="true">

    <scale
        android:duration="500"
        android:fromXScale="1.0"
        android:fromYScale="0.0"
        android:toXScale="1.0"
        android:toYScale="1.0" />

</set>

Animation 11 :

res/anim/

bouncexml

<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:fillAfter="true"
    android:interpolator="@android:anim/bounce_interpolator">

    <scale
        android:duration="500"
        android:fromXScale="1.0"
        android:fromYScale="0.0"
        android:toXScale="1.0"
        android:toYScale="1.0" />

</set>

Animation 12 :

res/anim/

sequential.xml

<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:fillAfter="true"
    android:interpolator="@android:anim/linear_interpolator" >

  
    <!-- Move -->
    <translate
        android:duration="800"
        android:fillAfter="true"
        android:fromXDelta="0%p"
        android:startOffset="300"
        android:toXDelta="75%p" />
    <translate
        android:duration="800"
        android:fillAfter="true"
        android:fromYDelta="0%p"
        android:startOffset="1100"
        android:toYDelta="70%p" />
    <translate
        android:duration="800"
        android:fillAfter="true"
        android:fromXDelta="0%p"
        android:startOffset="1900"
        android:toXDelta="-75%p" />
    <translate
        android:duration="800"
        android:fillAfter="true"
        android:fromYDelta="0%p"
        android:startOffset="2700"
        android:toYDelta="-70%p" />

    <!-- Rotate 360 degrees -->
    <rotate
        android:duration="1000"
        android:fromDegrees="0"
        android:interpolator="@android:anim/cycle_interpolator"
        android:pivotX="50%"
        android:pivotY="50%"
        android:startOffset="3800"
        android:repeatCount="infinite"
        android:repeatMode="restart"
        android:toDegrees="360" />

</set>

Animation 13 :

res/anim/

together.xml

<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:fillAfter="true"
    android:interpolator="@android:anim/linear_interpolator" >

    
    <!-- Move -->
    <scale
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:duration="4000"
        android:fromXScale="1"
        android:fromYScale="1"
        android:pivotX="50%"
        android:pivotY="50%"
        android:toXScale="4"
        android:toYScale="4" >
    </scale>

    <!-- Rotate 180 degrees -->
    <rotate
        android:duration="500"
        android:fromDegrees="0"
        android:pivotX="50%"
        android:pivotY="50%"
        android:repeatCount="infinite"
        android:repeatMode="restart"
        android:toDegrees="360" />

</set>


ImageView Shape


Step 1:

You have to do first :


compile 'com.github.siyamed:android-shape-imageview:0.9.+@aar'


Shape 1:   Bubble ImageView
<com.github.siyamed.shapeimageview.BubbleImageView
    android:layout_width="200dp"
    android:layout_height="200dp"
    android:src="@drawable/neo"
    app:siArrowPosition="right"
    app:siSquare="false"/>


Shape 2:   Rounded ImageView
<com.github.siyamed.shapeimageview.RoundedImageView
    android:layout_width="200dp"
    android:layout_height="200dp"    android:src="@drawable/neo"
    app:siRadius="6dp"
    app:siBorderWidth="6dp"
    app:siBorderColor="@color/darkgray"
    app:siSquare="false"/>


Shape 3:   Circle ImageView
<com.github.siyamed.shapeimageview.CircularImageView
    android:layout_width="200dp"    android:layout_height="200dp"    android:src="@drawable/neo"
    app:siBorderWidth="6dp"
    app:siBorderColor="@color/darkgray"/>


Shape 4:   Diamond ImageView
<com.github.siyamed.shapeimageview.DiamondImageView
    android:layout_width="200dp"    android:layout_height="200dp"    android:layout_margin="8dp"
    android:src="@drawable/neo"
    app:siBorderWidth="8dp"
    app:siBorderColor="@color/darkgray"/>


Shape 5:   Pentagon ImageView
<com.github.siyamed.shapeimageview.PentagonImageView
android:layout_width="200dp" android:layout_height="200dp" android:src="@drawable/neo" app:siArrowPosition="right" app:siSquare="false"/>


Shape 6:   Xexagon ImageView
<com.github.siyamed.shapeimageview.HexagonImageView
    android:layout_width="200dp"    android:layout_height="200dp"    android:src="@drawable/neo"
    app:siArrowPosition="right"
    app:siSquare="false"/>


Shape 7:   Octogon ImageView
<com.github.siyamed.shapeimageview.OctogonImageView
    android:layout_width="200dp"    android:layout_height="200dp"    android:src="@drawable/neo"
    app:siArrowPosition="right"
    app:siSquare="false"/>


Shape 8:   Star ImageView
<com.github.siyamed.shapeimageview.StarImageView
    android:layout_width="200dp"    android:layout_height="200dp"    android:src="@drawable/neo"
    app:siArrowPosition="right"
    app:siSquare="false"/>


Shape 9:  Heart  ImageView
<com.github.siyamed.shapeimageview.HeartImageView
    android:layout_width="200dp"    android:layout_height="200dp"    android:src="@drawable/neo"
    app:siArrowPosition="right"
    app:siSquare="false"/>


Shape 10:   Star ImageView
<com.github.siyamed.shapeimageview.mask.PorterShapeImageView
    android:layout_width="200dp"    android:layout_height="200dp"    app:siShape="@drawable/star"
    android:src="@drawable/neo"
    app:siSquare="false"/>
Shape 11:   PorterShape ImageView
<com.github.siyamed.shapeimageview.mask.PorterShapeImageView
    android:layout_width="200dp"    android:layout_height="200dp"    app:siShape="@drawable/shape_rounded_rectangle"
    android:src="@drawable/neo"
    app:siSquare="false"/>
res/drawable/ shape_rounded_rectangle.xml
<shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android">
    <corners
        android:topLeftRadius="18dp"
        android:topRightRadius="18dp"
        android:bottomLeftRadius="18dp"
        android:bottomRightRadius="18dp" />
    <solid android:color="@color/black" />
</shape>

HOW TO CREATE CIRCLE IMAGE VIEW

Step 1: implementation 'de.hdodenhof:circleimageview:3.0.0' Step 2: <de.hdodenhof.circleimageview.CircleImageView xmlns:ap...