Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9172855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:27:10+00:00 2026-06-17T16:27:10+00:00

I am trying to develop a few widgets for my application that look like

  • 0

I am trying to develop a few widgets for my application that look like the image below. I am not sure what to use for developing these. OpenGL or Android Canvas or a charting library like AiCharts

Could someone point me in the right direction?
Barometer like widgets

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T16:27:12+00:00Added an answer on June 17, 2026 at 4:27 pm

    I did view like this.

    enter image description here

    And can give you my code, but I did it so long time ago that code may be is not so good))

    public class Tachometer extends View {
        public static final String TAG = Tachometer.class.getSimpleName();
    
        private Bitmap tachometer;
        private Bitmap arrow;
    
        private float rotateDegree = 0;
        private float currentValue = 0;
        private float pxDp = getResources().getDimension(R.dimen.one_dp);
    
        private static final float MB = 1024;
        private static final float FIRST_RATE = MB / 105;
        private static final float SECOND_RATE = MB * 9 / 105;
        private static final float MIN_SPEED = 0;
        private static final float MAX_SPEED = MB * 10;
    
    
        public Tachometer(Context context) {
            super(context);
            initTachometer();
        }
    
       public Tachometer (Context context, AttributeSet attrs) {
            super(context, attrs);
            initTachometer();
        }
    
        private void initTachometer () {
            Options opt = new Options();
            opt.inScaled = true;
            tachometer = BitmapFactory.decodeResource(getContext().getResources(), R.drawable.tachometer_custom, opt);
            arrow = BitmapFactory.decodeResource(getContext().getResources(), R.drawable.arrow_custom , opt);
            setStartPosition();
            this.invalidate();
        }
    
        @Override
        public void onDraw(Canvas canvas) {
            super.onDraw(canvas);
            Matrix matrix = new Matrix();
            matrix.postRotate(rotateDegree, arrow.getWidth() / 2, arrow.getHeight() - 7.5f*pxDp);
            matrix.postTranslate((tachometer.getWidth()/2) - (arrow.getWidth()/2), 25*pxDp);
    
            drawRegion_1(canvas, initRed());
            drawRegion_2(canvas, initOrange());
            drawRegion_3(canvas, initYellow());
            drawRegion_4(canvas, initGreen());
    
            canvas.drawBitmap(tachometer, 0, 0, null);
            canvas.drawBitmap(arrow, matrix , null);
        }
    
        public void update (float value) {
            if (value < MIN_SPEED) update(MIN_SPEED); else
                if (value > MAX_SPEED) update(MAX_SPEED); else {
                    if (value < MB ) {
                        rotateDegree = (value / FIRST_RATE) - 105 ;
                    } else {
                        rotateDegree = ((value - MB) / SECOND_RATE);
                    }
                }
            currentValue = value;
            this.invalidate();
        }
    
        private void setStartPosition () {
            update(MIN_SPEED);
        }
    
        private void drawRegions (Canvas canvas , float startConer , float mainConer , int color) {
            Paint paint = new Paint();
            RectF rect = new RectF();
    
            rect.set((getResources().getDimension(R.dimen.left) - (getResources().getDimension(R.dimen.x37_5_dp))),
                    ((getResources().getDimension(R.dimen.top) - (getResources().getDimension(R.dimen.x37_5_dp)))),
                    ((getResources().getDimension(R.dimen.right) + (getResources().getDimension(R.dimen.x37_5_dp)))),
                    ((getResources().getDimension(R.dimen.bottom) + (getResources().getDimension(R.dimen.x37_5_dp))))); 
    
            paint.setColor(color);
            paint.setStrokeWidth(getResources().getDimension(R.dimen.stroke_width));
            paint.setAntiAlias(true);
            paint.setStyle(Paint.Style.STROKE);
            canvas.drawArc(rect, startConer, mainConer, false, paint);
        }
    
        private void drawRegion_1 (Canvas canvas , int color) {
            drawRegions(canvas , 163f , 60f , color);
        }
    
        private void drawRegion_2 (Canvas canvas , int color) {
            drawRegions(canvas , 163f+60f , 47f , color);
        }
    
        private void drawRegion_3 (Canvas canvas , int color) {
            drawRegions(canvas , 165f+63f+42f , 44f , color);
        }
    
        private void drawRegion_4 (Canvas canvas , int color) {
            drawRegions(canvas , 163f+63f+42f+46f , 62f , color);
        }
    
        private int initRed () {
            float piece = MB / 8; //~128kb/s
    
            if (currentValue == 0) return getResources().getColor(R.color.transpert); else 
                if (currentValue < piece) return getResources().getColor(R.color.red_75); else
                    if (currentValue < piece * 2) return getResources().getColor(R.color.red_50); else
                        if (currentValue < piece * 3) return getResources().getColor(R.color.red_25); else
                            return getResources().getColor(R.color.red);
    
        }
    
        private int initOrange () {
            float piece = MB / 8;//~128kb/s
    
            if (currentValue < piece * 4) return getResources().getColor(R.color.transpert); else 
                if (currentValue < piece * 5) return getResources().getColor(R.color.orange_75); else
                    if (currentValue < piece * 6) return getResources().getColor(R.color.orange_50); else
                        if (currentValue < piece * 7) return getResources().getColor(R.color.orange_25); else
                            return getResources().getColor(R.color.orange);
    
        }
    
        private int initYellow () {
            if (currentValue < MB) return getResources().getColor(R.color.transpert); else 
                if (currentValue < MB * 2) return getResources().getColor(R.color.yellow_75); else
                    if (currentValue < MB * 3) return getResources().getColor(R.color.yellow_50); else
                        if (currentValue < MB * 4) return getResources().getColor(R.color.yellow_25); else
                            return getResources().getColor(R.color.yellow);
    
        }
    
        private int initGreen () {
            float piece = MAX_SPEED / 9; //~1.2 Mb/sec
            float fiveMb = MB * 5;
    
            if (currentValue < fiveMb) return getResources().getColor(R.color.transpert); else 
                if (currentValue < fiveMb + piece) return getResources().getColor(R.color.green_75); else
                    if (currentValue < fiveMb + piece * 2) return getResources().getColor(R.color.green_50); else
                        if (currentValue < fiveMb + piece * 3) return getResources().getColor(R.color.green_25); else
                            return getResources().getColor(R.color.green);
    
        }
    }
    

    There are 4 sectors (red, orange, yellow, green) and depends on state colors can be transperent. Try to look at code. It can be helpful for you.

    Good luck!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to develop a small testing application that runs a few commands on
From past few days I'm trying to develop a regex that fetch all the
I'm trying develop a sample application with multi language files. I use: Windows 7
Getting a few errors and not sure what to do. Please help. Trying to
Im working with a few guys on trying to develop an app that requires
I have a few apps that I am trying to develop a reusable URL
I'm trying to develop an application that can stack FITS images. To read FITS
Im trying to develop service that starts by bootup receiver if the wifi or
im trying to develop an app for a win CE mobile device that downloads
I am trying to develop an application for my localhost on which I can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.