본문 바로가기
#모바일 [Mobile]/Android

[Android] Ripple Drawable (버튼 눌림 효과, 물결 효과)

by cy_mos 2019. 7. 24.
반응형
[Android] Ripple Drawable (버튼 눌림 효과, 물결 효과)

 

http://blog.csdn.net/a396901990/article/details/40187203                          http://blog.csdn.net/a396901990/article/details/40187203

 

  • Ripple touch effect was introduced with material design in Android 5.0 (API level 21) and the animation is implemented by the new RippleDrawable class. 
  • Ripple 터치 효과는 Android 5.0 (API Level 21 - 롤리팝)에서 Material Design과 함께 공개되었으며 RippleDrawable Class에 의해 애니메이션으로 동작합니다.
  • Drawable that shows a ripple effect in response to state changes.
  • 사용자에 의한 상태 변경에 대한 Ripple 터치 효과를 나타내는 Drawable 입니다.

📄 Ripple Drawable XML Source Code

ripple-tap.xml
0.00MB

<?xml version="1.0" encoding="utf-8"?>
<ripple
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:color="#88FFFFFF"> <!-- Ripple color :: WHITE (눌린 후 색상) -->

    <item>
        <!-- Normal bg color :: #164A7D (눌리기 전 색상) -->
        <color android:color="#164A7D" />
    </item>

    <!-- Make sure the ripple doesn't exceed the bounds -->
    <item android:id="@android:id/mask">
        <shape android:shape="rectangle">
            <solid android:color="?android:colorAccent" />
        </shape>
    </item>

</ripple>

🚀 REFERENCE

 

RippleDrawable  |  Android Developers

From class android.graphics.drawable.LayerDrawable int addLayer(Drawable dr) Adds a new layer containing the specified drawable to the end of the layer list and returns its index. void applyTheme(Resources.Theme t) Applies the specified theme to this Drawa

developer.android.com

 

Android - RippleDrawable | android Tutorial

android documentation: RippleDrawable

riptutorial.com

 

반응형

댓글