Android remove Fastforward and rewind buttons from

2020-07-10 11:13发布

问题:

I would Like to remove the fastforward and rewind buttons from mediacontroller in Android. Can anyone help me with this? I want to do it inside my main activity.

回答1:

When creating a MediaController, make sure to set the boolean to false in the constructor:

MediaController mediaController = new MediaController(this, false);

From the documentation:

The "rewind" and "fastforward" buttons are shown unless requested otherwise by using the MediaController(Context, boolean) constructor with the boolean set to false



回答2:

If you're trying to remove the buttons from a MediaPlayer than is not part of your app, this is impossible. You cannot mess with other apps' code. Some of them may allow you to pass this as an intent extra while launching them, but the majority probably won't.

If it is part of your app, just comment out the code related to the buttons.

EDIT: From the MediaController documentation:

  • The "rewind" and "fastforward" buttons are shown unless requested otherwise by using the MediaController(Context, boolean) constructor with the boolean set to false

So all you need to do is pass false in the constructor.