Page viewer sous android

15
Page Viewer

description

Comment utiliser le pageViewer avec la technique du swipe

Transcript of Page viewer sous android

Page 1: Page viewer sous android

Page Viewer

Page 2: Page viewer sous android

CONTACT

/PREEMPTIF

@ElZakaria

http://www.javailable.com

Page 3: Page viewer sous android

Concept

Page 4: Page viewer sous android

Concept

Page 5: Page viewer sous android

Projet

Extends FragmentActivity

Page 6: Page viewer sous android

Les fragments

import android.support.v4.app.Fragment;

Page 7: Page viewer sous android

Layouts

Layout_fragment1.xml Layout_fragment2.xml Layout_fragment3.xml

Page 8: Page viewer sous android

Main.xml (MyActivity.java)

<?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" />

Utilisé dans MyActivity.java

Page 9: Page viewer sous android

Un adapteur• Selon la doc Android :

- Doc android -

Page 10: Page viewer sous android

Class FragmentPagerAdap

ter

On lui passe le fragmentmanager de l’activité(extend FragmentActivity)

Page 11: Page viewer sous android

MyActivity.java

Voir détails méthodesaprès

Page 12: Page viewer sous android

Activer la navigation

Page 13: Page viewer sous android

Mise en place du ViewPager

Inner Class

Page 14: Page viewer sous android

Gérer le click sur les tabs

Page 15: Page viewer sous android

Résultat