Android remove Fastforward and rewind buttons from

2020-07-10 10:53发布

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.

2条回答
老娘就宠你
2楼-- · 2020-07-10 11:03

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

查看更多
等我变得足够好
3楼-- · 2020-07-10 11:21

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.

查看更多
登录 后发表回答