Create a custom View with animation

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Create a custom View with animation

Postby mangaluve » Wed Apr 01, 2009 1:29 pm

I thought about trying to write a custom progress bar, extending the regular one. What I want to achieve is to have a smooth filling of the progress (så if I go from 0 progress to, say, 10, I want it to be filled smoothly). So I thougt about extending ProgressBar and do this by internally just increate the progress by 1.

I thought about having some kind of thread inside my ProgressBar doing this. This thread will look at the current value of the progress, and add One as long as it's lower than the desired progress. So for instance, if I start with 0 progress and the user does setProgress(5). Then my loop should do setProgress(1), redraw, setProgress(2), redraw and so on.

Is this achievable? Can I use the Animation-classes or do I have to use a thread? And how do I redraw my component from this thread? (do I have to redraw the entire activity or could I just redraw that view?)
Experienced Developer
Experienced Developer
Posts: 82
Joined: Mon Mar 23, 2009 8:59 pm


Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Google [Bot] and 10 guests