android - How to simultaneously change the value of one seekbar based on other -
have 3 seekbars on 1 activity. of them have max of 100. need sum of 3 100.
when seek1=50 , seek2=45 seek3 must 5. when slide seek1 55 seek3 must have 0. etc.
how can code this?
sorry, here code:
//01 final seekbar seekbar01 = (seekbar)findviewbyid(r.id.seek01); final textview seekbar01value = (textview)findviewbyid(r.id.txt01val); seekbar01.setonseekbarchangelistener(new seekbar.onseekbarchangelistener() { @override public void onprogresschanged(seekbar seekbar, int progress, boolean fromuser) { seekbar01value.settext(string.valueof(progress)); } @override public void onstarttrackingtouch(seekbar seekbar) { } @override public void onstoptrackingtouch(seekbar seekbar) { } }); //02 seekbar seekbar02 = (seekbar)findviewbyid(r.id.seek02); final textview seekbar02value = (textview)findviewbyid(r.id.txt02val); seekbar02.setonseekbarchangelistener(new seekbar.onseekbarchangelistener() { @override public void onprogresschanged(seekbar seekbar, int progress, boolean fromuser) { seekbar02value.settext(string.valueof(progress)); } @override public void onstarttrackingtouch(seekbar seekbar) { } @override public void onstoptrackingtouch(seekbar seekbar) { } }); //03 seekbar seekbar03 = (seekbar)findviewbyid(r.id.seek03); final textview seekbar03value = (textview)findviewbyid(r.id.txt03val); seekbar03.setonseekbarchangelistener(new seekbar.onseekbarchangelistener() { @override public void onprogresschanged(seekbar seekbar, int progress, boolean fromuser) { seekbar03value.settext(string.valueof(progress)); } @override public void onstarttrackingtouch(seekbar seekbar) { } @override public void onstoptrackingtouch(seekbar seekbar) { } });
i can show values on respective textviews, don't how change seebar progress other seekbar onprogresschanged.
set onseekbarchangelistener seekbars. when 1 changes, set values others setprogress
Comments
Post a Comment