android - how to create ripple effect for pre-lollipop -


how apply ripple effect this

i have put dependencies in app/build.gradle

app/build.gradle

dependencies {     compile 'com.github.traex.rippleeffect:library:1.3' } 

build.gradle

allprojects{     repositories{         jcenter()         maven(url "https://jitpack.io" } 

xml file:

<com.andexert.library.rippleview         android:id="@+id/rect1"         android:layout_width="match_parent"         android:layout_height="wrap_content">   <button       android:id="@+id/enterbutton"       android:layout_width="match_parent"       android:layout_height="wrap_content"       android:text="save user name" />  </com.andexert.library.rippleview> 

java class file

protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.save_user);     edittext=(edittext) findviewbyid(r.id.usernameedittext);     button=(button) findviewbyid(r.id.enterbutton);      sharedpreferences=getsharedpreferences(shared_name_string, mode_private);     string usernamestring=sharedpreferences.getstring(user_name_string, "");      edittext.settext(usernamestring);      button.setonclicklistener(new view.onclicklistener() {          @override         public void onclick(view v) {             string string=edittext.gettext().tostring();             intent intent=new intent(saveuser.this, mainactivity.class);             intent.putextra("user", string);              sharedpreferences.editor editor=sharedpreferences.edit();             editor.putstring(user_name_string, string);             editor.commit();              startactivity(intent);          }     }); } 

it works problem activity opens before ripple effect completes , when press button remaining ripple completes. how can solve it??

you try library balysv/material-ripple.

in gradle, add line :

compile 'com.balysv:material-ripple:1.0.2' 

and how :

<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 ripple"/> </com.balysv.materialripple.materialripplelayout> 

Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -