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.