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!
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?
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.
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With