android - Animation in seekbar to go to initial point once thumb is dragged to its end -


how animate seekbar 1 drags thumb seekbar max value thumb automatically goes initial point.i begginer plz if possible give elaborated answer

sb.setonseekbarchangelistener(new onseekbarchangelistener() {                          @override                         public void onstoptrackingtouch(seekbar seekbar) {                             // todo auto-generated method stub                          }                          @override                         public void onstarttrackingtouch(seekbar seekbar) {                             // todo auto-generated method stub                          }                          @override                         public void onprogresschanged(seekbar seekbar,                                 int progress, boolean fromuser) {                              value = sb.getprogress();                              if (value == 50) {                                 drawable drawable = getresources().getdrawable(                                         r.drawable.off);                                 sb.setthumb(drawable);                              }                              valueanimator anim = valueanimator.ofint(seekbar.getprogress(),0);                             anim.setduration(1000);                             anim.addupdatelistener(new animatorupdatelistener() {                                 @override                                 public void onanimationupdate(valueanimator animation) {                                 int animprogress = (integer) animation.getanimatedvalue();                                 sb.setprogress(animprogress);                                 }                             });                             anim.start();                          }                     }); 

i have got answer question. if 1 need it, is....

seekbar sb; valueanimator anim; int value; sb.setonseekbarchangelistener(new onseekbarchangelistener() {      @override     public void onprogresschanged(seekbar seekbar,             int progress, boolean fromuser) {         }     }      @override     public void onstarttrackingtouch(seekbar seekbar) {     }      @override     public void onstoptrackingtouch(seekbar seekbar) {         value = sb.getprogress();         valueanimator anim = valueanimator.ofint(value,                 sb.getmax());         anim.setduration(1000);         anim.addupdatelistener(new valueanimator.animatorupdatelistener() {             @override             public void onanimationupdate(                     valueanimator animation) {                 value = (integer) animation                         .getanimatedvalue();                 sb.setprogress(value);             }         });         anim.start();         new handler().postdelayed(new runnable() {             @override             public void run() {                 valueanimator anim = valueanimator.ofint(0,                         sb.getmax());                 anim.setduration(1000);                 anim.addupdatelistener(new valueanimator.animatorupdatelistener() {                     @override                     public void onanimationupdate(                             valueanimator animation) {                         value = (integer) animation                                 .getanimatedvalue();                         value = 100 - value;                         sb.setprogress(value);                     }                 });                 anim.start();             }         }, 1200);     } }); 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -