Question

I am using this LIBRARY for my slide up panel. every thing is working fine with a simple layout. Now my question is , how can I insert a pager title strip in that panel so that I can make it my View pager working on it with multiple fragments.

first image with panel and pager title strip

slide up to view panel

First image is title strip at bottom second is slide up and sliding fragments

Was it helpful?

Solution

From your previous post, I'm assuming you're using this library (https://github.com/umano/AndroidSlidingUpPanel).

This library requires that you have 2 children views. The first one being the main layout and the second one the actual sliding view. Now, your sliding view is just a placeholder, so you can place anything you want in there. If you want to add a ViewPager, this is how you can do it.

<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>

What we have here is the main layout of our Activity (RelativeLayout) and we're adding the SlidingPanelLayout to it. Inside this Layout, we've defined our main layout to be a LinearLayout (Top Panel) and a second LinearLayout (Sliding Panel) which is the actual sliding view. Now, all we need to do is add a ViewPager to this sliding panel.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top