You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2021/01/16 00:24:35 UTC

[GitHub] [cordova-android] FreddyJohn commented on issue #1147: setTickMark in Java results in runtime NoSuchMethod error

FreddyJohn commented on issue #1147:
URL: https://github.com/apache/cordova-android/issues/1147#issuecomment-761271663


   here is how to create tickmarks no matter what api version
   
   public class test extends androidx.appcompat.widget.AppCompatSeekBar {
       public test(Context context, AttributeSet attrs) {
           super(context, attrs);
           setProgress(10);
           setRotation(270);
           setMax(10);
           float p = Resources.getSystem().getDisplayMetrics().density;
           int height = (int) (90*p);
           int width = (int) (100*p);
           setLayoutParams(new LinearLayout.LayoutParams(width, height));
           Drawable d = context.getDrawable(R.drawable.seekbar_tickmark);
           Drawable t = context.getDrawable(R.drawable.seekbar_thumb);
           setThumb(t);
       }
   
       @Override
       protected synchronized void onDraw(Canvas canvas) {
           Paint paint = new Paint(R.color.black);
           DisplayMetrics display = Resources.getSystem().getDisplayMetrics();
           paint.setStrokeWidth(20);
           int height = display.heightPixels;
           int width = display.widthPixels;
           int spacing = width/getMax();
           int tickwidth = 40;
           if (getMax()>2) {
               for (int i = 1; i < getMax(); i++) {
                   width-=spacing;
                   canvas.drawLine((width)+(tickwidth/2), height / 2 - 80, (width)-(tickwidth/2), height / 2 - 80, paint);
                   canvas.drawLine((width)+(tickwidth/2), height / 2 + 80, (width)-(tickwidth/2), height / 2 + 80, paint);
   
               }
           }
           super.onDraw(canvas);
       }
   }


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org