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 6590225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:16:23+00:00 2026-05-25T17:16:23+00:00

i want to build a component that will be able to show a integer

  • 0

i want to build a component that will be able to show a integer number max 5 digits in the style of the old analog car counters and animate the digit change.

that looks something like this maybe…

alt text

i have tried searching for this kinda of examples but i couldn’t find anything so far.

in your opinion what is the best approach to achieve this?

i looked at the iphone alarm time picker and as far as i can tell there is only a fixed background and they push the numbers in or out the view. but how do i place the digits in this case and reference them to a particular value?

tnx.

  • 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-05-25T17:16:24+00:00Added an answer on May 25, 2026 at 5:16 pm

    You can try to create your own view, extending view and overriding onDraw().
    Here you can use rows of numbers in bitmaps and editing their position based on the number you wish to show.
    Dont forget to call invalidate() after setting new numbers to redraw the view.

    I will paste an example containing a start for your project.
    The bitmap number is a vertical image with numbers from 1-9 (and 0&.)

    Ex.

    class TickerView extends View { .. 
    
    
    public void setDouble(double d) {
            value = d;
            invalidate();
        }
            protected void onDraw(Canvas canvas) {
            super.onDraw(canvas);
            int startx = 0;
            int starty = 0;
            DecimalFormat df = new DecimalFormat("#0.00");
            String str = df.format(value);
            String original = Double.toString(value);
    
            Bitmap nums = BitmapFactory.decodeResource(context.getResources(),
                    R.drawable.numbers);
    
            for (int i = 0; i < str.length(); i++) {
                int num = 0;
                try {
                    num = Integer.parseInt(str.charAt(i) + "");
                } catch (Exception e) {
                    num = 10;
                }
                int numbefore = 0;
                try {
                    numbefore = Integer.parseInt(original.charAt(i -1) + "");
                } catch (Exception e) {
                    numbefore = 0;
                }
    
                canvas.drawBitmap(nums, startx + (i * 40), (starty + 40)
                        - (num * 50) + (numbefore), paintY);
    
            }
            paintY.setStrokeWidth(10);
            canvas.drawLine(startx, starty+36, startx + (str.length() * 40), starty+36,
                    paintY);
            canvas.drawLine(startx, starty + 90, startx + (str.length() * 40),
                    starty + 90, paintY);
            invalidate();
        }
    
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to build a component, where the user can play a video in
i want build a photography app with effects . e.g. old images with brown
I want build a sketch pad app on iPhone, I assume that this type
I want to build a bot that asks someone a few simple questions and
I am about to build a system that will have its own engine, as
I have a number of complex processing tasks that will produce messages, warnings, and
I'm trying to build an app that will display stats for a certain game
I want to build a lightweight linux configuration to use for development. The first
I want to build my own custom log4j (network) adapter to solve my problem
I want to build an executable to distribute to people without python installed on

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.