[Android] calling button effect library (ripple)
안드로이드 개발시 전화받는 이미지를 구현해야할 경우가 있다.
<이미지>
위와 같은 이미지를 구현하기 위해 ripple 효과를 찾아보게 되었고,
"Android Ripple Background"
라는 라이브러리를 발견하였다.
<사용방법>
<com.skyfishjy.library.RippleBackground
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/content"
app:rb_color="#0099CC"
app:rb_radius="32dp"
app:rb_rippleAmount="4"
app:rb_duration="3000"
app:rb_scale="6">
<이미지뷰 넣기>
</com.skyfishjy.library.RippleBackground>
사용방법은 위의 레이아웃 안에 이미지뷰를 삽입하여 효과를 주면된다.
dependencies { implementation 'com.skyfishjy.ripplebackground:library:1.0.1' } - 추가
rippleBackground.startRippleAnimation(); - 애니매이션시작
rippleBackground.stopRippleAnimation(); - 애미매이션 멈춤
- app:rb_color [color def:@android:color/holo_blue_dark] --> 물결색상
- app:rb_radius [dimension def:64dp ] --> 물결반경
- app:rb_duration [integer def:3000 ] --> 애니메이션 지속시간
- app:rb_rippleAmount [integer def:6] --> 최대 잔물결 양
- app:rb_scale [interger def:6] --> 리플의 스케일
- app:rb_type [enum (fillRipple, strokeRipple) def:fillRipple] --> Filled circle or ring
- app:rb_strokeWidth [dimension def:2dp] --> Stroke width of the ripple, ONLY work when rb_type="strokeRipple"
https://github.com/skyfishjy/android-ripple-background
skyfishjy/android-ripple-background
A beautiful ripple animation for your app. Contribute to skyfishjy/android-ripple-background development by creating an account on GitHub.
github.com
위링크를 보면 자세한사용 방법이 나와있다.