Menu/Arrow Animation using Canvas api in android. You can see the original design by Apostol Voicu.
See How to implement this in my blog
If you want use this library, you only add the project as a library in your android project settings.
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.laewoong:MenuArrowAnimation:1.0.2'
}
This components have custom attributes, if you want use them, you must add this line in your xml file in the first component:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
...
>
</RelativeLayout>
You can set two attributes: strokeWidth, strokeColor.
<com.laewoong.menuarrowanimation.MenuArrowAnimationButton
android:layout_width="80dp"
android:layout_height="40dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:strokeWidth="20"
app:strokeColor="#d7e4f0"/>
You can check button status using isArrowStatus()
method.
btn = (MenuArrowAnimationButton)findViewById(R.id.btn);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Log.i("fff", "OnClicked!!!! : " + btn.isArrowStatus());
}
});
Check the video in youtube