2016-07-29 7 views
0

dieser Schuss unter Bildschirm ist Gmail viewpager, die die Umrisse Grenzen für viewpager implementiert FragmentsAndroid implemeneting Gmail viewpager Grenze umreißen

Streichen von links nach rechts

enter image description here

Swipe von rechts nach links

enter image description here

Und jetzt möchte ich, dass für meine Anwendung auf die Umsetzung aber, dass Design:

Streichen von links nach rechts

enter image description here

Swipe von rechts nach links

enter image description here

xml Mein Wurzel-Layout ist:

<FrameLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_marginLeft="-15dp" 
    android:layout_marginRight="-30dp" 
    android:background="#949494" 
    android:paddingLeft="-15dp" 
    android:paddingRight="-15dp"> 

    <FrameLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_marginLeft="15dp" 
     android:layout_marginRight="30dp" 
     android:background="#ffffff"> 

     ... 

    </FrameLayout> 

</FrameLayout> 

Antwort

1

Vielleicht wollen Sie so etwas? insert separator between view-pager

Sie können einen Zeichnungsbereich verwenden, um den Stil zu reproduzieren.

+0

Ich denke, das viewpager 3 Layout hat, mit 3 Farbe, die Sie auf meinem Thema –

+0

A ziehbar nicht sehen kann eine Farbe sein muss. Ein Drawable kann auch ein Objekt mit mehreren Farben oder ein 9 Patch sein – Mdlc

0

Meine Lösung

Ergebnis viewpager wie mit Google Mail zur Umsetzung:

enter image description here

viewPager Wurzel Layout:

<FrameLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:background="#d1d1d1"> 
    <android.support.v4.view.ViewPager 
     android:id="@+id/vp_horizontal_ntb" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_marginLeft="-25dp" 
     android:layout_marginRight="-25dp" 
     android:layout_marginTop="30dp"/> 

Fragment Layout:

<FrameLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_marginLeft="-20dp" 
    android:layout_marginRight="-20dp" 
    android:background="#eeeeee"> 

    <FrameLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_marginLeft="15dp" 
     android:layout_marginRight="15dp" 
     android:background="#ffffff"> 
    </FrameLayout> 

</FrameLayout> 

und setPageMargin:

viewPager.setPageMargin(80);