Android SeekBar strange behaviour -


i have default seekbar in android 3 possible values: 0,1,2 (left, middle, right).

but takes value when finger on point(corresponding value) or right of it. if finger 1 pixel left of point, seekbar takes previous value.

i want take value when finger near point. explanation skill poor, see picture: drawing

if using 3 points isn't enough, why not add more points , map 3? e.g.

private static final double ratios = new double[]{ .33, 66, 100 } private static final int faked_points = new int[]{ 0, 50, 100 }  private void setupseekbar() {     // normal setup     seekbar.setmax(100); }  @override public void onprogresschanged(seekbar seekbar, int progress, boolean fromuser) {     if(!fromuser) // want when user changes values         return;      for(int = 0; < ratios.length; i++){         if(progress <= ratios[i]){             onrealprogresschanged(i);              seekbar.setprogress(faked_points[i]); //  way stays on our 3 faked points         }     } }  private void onrealprogresschanged(int realprogress){     // deal real changed value (being 0, 1, or 2) } 

if need more fine-tuning, can scale order of magnitude.

not clean or pretty, should point in right direction.


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -