滑动面板与视图翻页标题条

3
我正在使用LIBRARY来制作我的滑动面板,简单的布局一切正常。现在我的问题是,我如何在面板中插入一个分页标题条,以便我可以将其作为我的View pager,并在其中使用多个片段。

first image with panel and pager title strip

slide up to view panel

第一张图片是底部的标题条 第二张是向上滑动和滑动片段


1
这里有一个不错的教程:http://androidsolution4u.blogspot.in/2013/04/tabnvigation-like-google-play-store-app.html - Ketan Ahir
好的,这个链接可以使用...但不是我想要的!谢谢。 - Cyph3rCod3r
1个回答

3

根据您之前的帖子,我假定您正在使用这个库(https://github.com/umano/AndroidSlidingUpPanel)。

这个库要求您有两个子视图。第一个是主布局,第二个是实际的滑动视图。现在,您的滑动视图只是一个占位符,所以您可以在里面放置任何东西。如果您想添加ViewPager,则可以按照以下步骤进行操作。

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <SlidingUpPanelLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <!-- Top Panel -->
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent" >
        </LinearLayout>

        <!-- Sliding Panel -->
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical" >

            <android.support.v4.view.ViewPager
                android:layout_width="match_parent"
                android:layout_height="match_parent" >
            </android.support.v4.view.ViewPager>
        </LinearLayout>
    </SlidingUpPanelLayout>

</RelativeLayout>

我们这里有一个Activity的主要布局(RelativeLayout),我们正在向其中添加SlidingPanelLayout。在这个布局里,我们定义了我们的主要布局是一个LinearLayout(上部面板)和第二个LinearLayout(滑动面板),它是实际的滑动视图。现在,我们只需要将ViewPager添加到这个滑动面板中即可。

你能发布一些关于这个的屏幕截图吗? - Cyph3rCod3r
抱歉,由于应用程序尚未发布,我无法上传截图。但它实际上与Google Play音乐应用程序完全相同。您有主视图,其中显示您的专辑列表,当您向上滑动面板时,您基本上可以访问一个ViewPager,其中显示当前播放列表。 - Henrique
我能否在这上面加入手势,使得从左向右滑动会像Google Play音乐一样做某些事情(更改当前播放的音乐)? - Cyph3rCod3r
我已经添加了一个视图翻页器,但它不能在片段之间滑动 :( - Cyph3rCod3r
它卡住了,我不知道发生了什么。 - Cyph3rCod3r
显示剩余3条评论

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接