changing default start value for seekbar in android -
the default start value seekbar 0. possible change value 10? please explain me how set value.
thanks in advance.
try below code:
seekbar seekbar = (seekbar)layout.findviewbyid(r.id.seekbar); seekbar.setprogress(0); seekbar.incrementprogressby(10); seekbar.setmax(200); textview seekbarvalue = (textview)layout.findviewbyid(r.id.seekbarvalue); seekbarvalue.settext(tvradius.gettext().tostring().trim()); seekbar.setonseekbarchangelistener(new seekbar.onseekbarchangelistener(){ @override public void onprogresschanged(seekbar seekbar, int progress, boolean fromuser) { progress = progress / 10; progress = progress * 10; seekbarvalue.settext(string.valueof(progress)); } @override public void onstarttrackingtouch(seekbar seekbar) { } @override public void onstoptrackingtouch(seekbar seekbar) { } });
setprogress(int)
used set starting value of seek bar
setmax(int)
used set maximum value of seek bar
if want set boundaries of seekbar can check progressbar value in onprogresschanged method. if progress less or greater boundary can set progress boundary defined.
Comments
Post a Comment