為Android Views提供Ripple效果封裝:Material Ripple Layout

Material Ripple Layout這個項目為Android Views提供Ripple效果封裝。

Demo Image

用法

Use static initializer on your View (see xml attributes below for customization)

MaterialRippleLayout.on(view)
           .rippleColor(Color.BLACK)
           .create();

Or wrap your View with MaterialRippleLayout in your layout file:

<com.balysv.materialripple.MaterialRippleLayout
    android:id="@+id/ripple"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:text="Button inside a ripple"/>

</com.balysv.materialripple.MaterialRippleLayout>

If using in an `AdapterView` you must set `rippleInAdapter` to `true`

Configure using xml attributes or appropriate setters in code:

app:rippleOverlay="true"              // if true, ripple is drawn in foreground; false - background
app:rippleColor="#ff0000"             // color of ripple
app:rippleAlpha="0.1"                 // alpha of ripple
app:rippleDimension="10dp"            // radius of hover and starting ripple
app:rippleHover="true"                // if true, a hover effect is drawn when view is touched
app:rippleInAdapter="true"            // if true, MaterialRippleLayout will optimize for use in AdapterViews
app:rippleDuration="350"              // duration of ripple animation
app:rippleFadeDuration="75"           // duration of fade out effect on ripple
app:rippleDelayClick="true"           // if true, delays calls to OnClickListeners until ripple effect ends
app:rippleBackground="#FFFFFF"        // background under ripple drawable; used with rippleOverlay="false"
app:ripplePersistent="true"           // if true, ripple background color persists after animation, until setRadius(0) is called

項目主頁:http://www.baiduhome.net/lib/view/home/1414571782903

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!