我正在使用LIBRARY来制作我的滑动面板,简单的布局一切正常。现在我的问题是,我如何在面板中插入一个分页标题条,以便我可以将其作为我的View pager,并在其中使用多个片段。
第一张图片是底部的标题条 第二张是向上滑动和滑动片段
第一张图片是底部的标题条 第二张是向上滑动和滑动片段
根据您之前的帖子,我假定您正在使用这个库(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>
SlidingPanelLayout
。在这个布局里,我们定义了我们的主要布局是一个LinearLayout(上部面板)和第二个LinearLayout(滑动面板),它是实际的滑动视图。现在,我们只需要将ViewPager添加到这个滑动面板中即可。