问题
I am Learning Material Design. I tried ripple effect on button using this gradle
dependencies {
compile 'com.github.traex.rippleeffect:library:1.3'
}
from this https://github.com/traex/RippleEffect link
there are many attribute which are not working such as
app:rv_rippleDuration="1200"
app:rv_color="#d3d3d3"
I have event on button and ripple effect but when I click on button method is get called. What I want is first ripple effect should get complete then action should occur.
XML code
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp">
<com.andexert.library.RippleView
android:id="@+id/ripple1"
android:layout_width="match_parent"
android:layout_height="match_parent"
rv_centered="true"
app:rv_rippleDuration="1800"
app:rv_color="#000000">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/fromDateButton" />
</com.andexert.library.RippleView>
</LinearLayout>
user cannot experience animation.
回答1:
You need to add xmlns:app="http://schemas.android.com/apk/res-auto"
as an xmlns
in your RippleView before using the app resource.
回答2:
Problem in the example on the page of description in GitHab. Change
rv_centered="true"
to
app:rv_centered="true"
and all will be done.
All attribute of ReppleView must contain app:
来源:https://stackoverflow.com/questions/31251820/ripple-effect-duration-in-android-xml