如何添加持久媒体控件,例如 Apollo 或 Google 音乐

2024-04-15

I would like to add music controls such as play/pause, next, and back as well as show a thumbnail and song title to the bottom of an application like in the Google music app.
So this When the thumbnail or title is tapped on, I want to bring up a detailed view of song, including a seek bar.
Like this I am wondering what the best approach for this would be. Should I just add a relative layout the the bottom of my apps xml, and add on click listeners, or can this be accomplished simply with something like the MediaController class?


您应该使用片段来构建您的应用程序。谷歌已经弃用了许多以前的 API 功能,转而使用片段,并试图促使开发人员在新应用程序中更多地使用它们。

假设您正在创建一个媒体播放器,应用程序主屏幕的歌曲列表部分将是片段中的 ListView,底部控制器部分将是包含您想要的任何按钮和滑块的另一个片段。

如何创建显示歌曲信息的详细屏幕取决于您希望该屏幕的外观,但最直接的方法是将专辑缩略图显示为“控制器”片段中的 ImageButton 并创建一个新的单击时的活动。

你可以找到有关片段的信息在这里 https://developer.android.com/guide/components/fragments.html and 这里有关于构建 Android 音频播放器的教程。 http://www.androidhive.info/2012/03/android-building-audio-player-tutorial/

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何添加持久媒体控件,例如 Apollo 或 Google 音乐 的相关文章

随机推荐