Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to make a custom VideoView progress bar without building a MediaPlayer from scratch?

I am currently making an Android app and I'm going to need to make a custom video player. I just need to change its ProgressBar color. Is there a simple way to do that?

I know I could do that using Commonsguy example. But it's not so good as the native video player and I think it would be making a lot for only a change of color.

Any help appreciated!

like image 799
Romain Piel Avatar asked Oct 07 '11 15:10

Romain Piel


People also ask

How do I make a custom ProgressBar?

Customizing a ProgressBar requires defining the attribute or properties for the background and progress of your progress bar. You can do this in the XML file or in the Activity (at run time). Why is it necessary to set the progress drawable at runtime, when it is possible to do it on the xml file?

How do I change the ProgressBar icon on Android?

Go to the activity_main. xml file and refer to the following code. Open the activity_main. xml file and in the ProgressBar tag and set the drawable in indeterminateDrawable attribute.

What is indeterminate ProgressBar android?

ProgressBar is used to display the progress of an activity while the user is waiting. You can display an indeterminate progress (spinning wheel) or result-based progress.

Which of the following can you use to display a ProgressBar in an Android application?

To add a progress bar to a layout (xml) file, you can use the <ProgressBar> element. By default, a progress bar is a spinning wheel (an indeterminate indicator). To change to a horizontal progress bar, apply the progress bar's horizontal style.


2 Answers

I ended up building a media player from scratch based on Commonsguy example. I've tried to use Android source code for a few classes. MediaController looks exactly like what I needed to customize but it uses to many internal resources that we don't have access to.

like image 140
Romain Piel Avatar answered Sep 17 '22 19:09

Romain Piel


The native video player will be intrinxically linked to the system theme so changing the color is not possible.

You could try extendingthe native player and using it as a custom activity in your project, you might then be able to change the theme via your manifest.xml or in code.

like image 41
Moog Avatar answered Sep 18 '22 19:09

Moog