如何在我的ViewPager中使用PagerStrip布局在Android中实现SlideUpPanel

时间:2016-06-25 06:03:40

标签: android

我是Android开发新手。我想在我的android项目中使用Pagerstrip Layout在已实现的ViewPager中实现this SlideUpPanel

这是我想要实现SlideUpPanel的ViewPager布局screenshot

这是我的mainActivity.xml

<?xml version="1.0" encoding="utf-8"?>

<android.support.v4.view.ViewPager   xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/mainbg">

<android.support.v4.view.PagerTabStrip
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="top"
    android:paddingBottom="10dp"
    android:paddingTop="10dp"
    android:textSize="20sp"
    android:textColor="#D3D3D3"
    android:background="#33000000"/>


  </android.support.v4.view.ViewPager>

这是我的SlideUpPanel.xml

<?xml version="1.0" encoding="utf-8"?>

<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"
tools:context=".MainActivity" >
<com.sothree.slidinguppanel.SlidingUpPanelLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:sothree="http://schemas.android.com/apk/almamusiq"
android:id="@+id/sliding_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom"
sothree:umanoPanelHeight="68dp"
sothree:umanoShadowHeight="4dp"
sothree:umanoParallaxOffset="100dp"
sothree:umanoDragView="@+id/dragView"
sothree:umanoOverlay="true"
sothree:umanoScrollableView="@+id/list">

<!-- MAIN CONTENT -->
<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:id="@+id/pager">
<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"

        android:background="@drawable/mainbg"
        android:layout_height="match_parent"
        android:layout_width="match_parent">

        <android.support.v4.view.PagerTabStrip
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="top"
            android:paddingBottom="10dp"
            android:paddingTop="10dp"
            android:textSize="20sp"
            android:textColor="#D3D3D3"
            android:background="#33000000"/>


    <TextView
        android:id="@+id/main"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginTop="?attr/actionBarSize"
        android:gravity="center"
        android:text="Main Content"
        android:clickable="true"
        android:focusable="false"
        android:focusableInTouchMode="true"
        android:textSize="16sp" />
</android.support.v4.view.ViewPager>
</FrameLayout>

<!-- SLIDING LAYOUT -->
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#ffffff"
    android:orientation="vertical"
    android:clickable="true"
    android:focusable="false"
    android:id="@+id/dragView">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="68dp"
        android:orientation="horizontal">

        <TextView
            android:id="@+id/name"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:textSize="14sp"
            android:gravity="center_vertical"
            android:paddingLeft="10dp"/>

        <Button
            android:id="@+id/follow"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:textSize="14sp"
            android:gravity="center_vertical|right"
            android:paddingRight="10dp"
            android:paddingLeft="10dp"/>

    </LinearLayout>

    <ListView
        android:id="@+id/list"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1">
    </ListView>


</LinearLayout>
</com.sothree.slidinguppanel.SlidingUpPanelLayout>
</RelativeLayout>

0 个答案:

没有答案