构建类似 Play Music 的界面 [英] Build Play Music-like interface
本文介绍了构建类似 Play Music 的界面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试构建和界面来模仿最近的 Google Play 音乐界面,作为提醒,它在手机上看起来像这样
I'm trying to build and interface that would mimic the recent Google Play Music interface which as a reminder looks like this on a phone
我已经正确设置了 DrawerLayout
和 Tabs,但我不知道如何构建显示当前播放歌曲的惊人底部片段.它混合了两个功能:
I've already got the DrawerLayout
and the Tabs right, but I have no idea how to build the amazing bottom fragment that displays the currently playing song. It mixes two features:
- 如果您向左滑动此片段,它将被下一首歌曲替换.我认为对于每首歌曲使用
ViewPager
和新的Fragment
可以相当快地完成,但这是一种有效的方法吗? - 如果向上滑动它,它将打开一个包含播放器本身的抽屉(参见上面的第二个和第三个屏幕截图).我怎样才能在我的应用程序中获得类似的东西?我在文档中找不到任何提及,所以我想这不是真正的官方.
- If you swipe this fragment to the left, it will be replaced by the next song. i think it can be done fairly quickly using a
ViewPager
and a newFragment
for each song, but is it an efficient way to do it? - If you swipe it up, it will open kind of a drawer containing the player itself (see the above second and third screenshots). How can I get something similar inside my application? I can't find any mention of this inside the docs so I guess it's not really official.
推荐答案
- 使用 AndroidSlidingUpPanel 库.它非常易于使用.
- 在此面板中添加一个 FragmentPager下一首歌曲"功能.也可以作为上拉面板的把手".
- 在上滑面板布局中添加播放器布局
- Use AndroidSlidingUpPanel library. It is pretty easy to use.
- Add a FragmentPager inside this panel for the "Swipe left for the next song" feature. It also can be the "handle" for sliding up panel.
- Add the player layout inside the sliding up panel layout
这篇关于构建类似 Play Music 的界面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文