MultiViewPager


Source link: https://github.com/Pixplicity/MultiViewPager

MultiViewPager

UPDATE: This behavior is now included in the RecyclerView for support lib 24.2.0 and later. Please look at using LinearSnapHelper.

The MultiViewPager is an extension of the support-v4 library's ViewPager that allows the pages to be wider or narrower than the ViewPager itself. It takes care of aligning the pages next to each other, and always keeping the selected page centered.

Sample

Simply add the MultiViewPager into your layout:

<com.pixplicity.multiviewpager.MultiViewPager
  android:id="@+id/pager"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  app:matchChildWidth="@+id/child_view_to_match" /> 

Be sure to declare the app namespace:
xmlns:app="http://schemas.android.com/apk/res-auto"

Take note of the custom attribute matchChildWidth. This attribute should match an ID in the ViewPager's first child view. In the sample project, the layout of the pages is:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  tools:context="${
relativePackage
}
.${
activityClass
}
" >

<FrameLayout

android:id="@+id/vg_cover"

android:layout_width="200dp"

android:layout_height="match_parent"

android:layout_centerInParent="true" >

 <ImageView

 android:layout_width="match_parent"

 android:layout_height="match_parent"

 android:padding="16dp"

 android:background="@drawable/bg_page"

 android:scaleType="centerInside"

 android:src="@drawable/im_pixplicity"

 tools:ignore="ContentDescription" />

</FrameLayout>  </RelativeLayout> 

The child view with ID @id/vg_cover will determine the width of the page. In this example, the width would be 200dp. In order to get this hooked up, we provide MultiViewPager with the reference to the child, @id/vg_cover:

<com.pixplicity.multiviewpager.MultiViewPager
  android:id="@+id/pager"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  app:matchChildWidth="@+id/vg_cover" /> 

In this way, it knows to size the pages according to the dimension of that View or ViewGroup.

Download

Download the latest AAR or grab via Maven:

<dependency>
<groupId>com.pixplicity.multiviewpager</groupId>
<artifactId>library</artifactId>
<version>1.0</version>
<type>aar</type> </dependency>

or Gradle:

compile 'com.pixplicity.multiviewpager:library:1.0'

License

Licensed under the Apache license.

Resources

Android Runtime Permissions Library to support Android 6.0+

NetSugar is an Android + AOP framework. It was a way of Aspect-Oriented Programming with AspectJ(ApsectJ 5) on Android. It is an easy-use and lightweight framework to check network state.

Utilities for using RxJava with Realm.

Snacky is a small library to help you adding a Snackbar to your layout with ease. Snacky uses an easy builder pattern to build a Snackbar and gives you some template designs like ERROR, WARNING, INFO and SUCCESS as well as some customization options.

Android layout to show most common state templates like loading, empty, error etc. To do that all you need to is wrap the target area(view) with StatefulLayout.

Rx2Animations is a library with the main goal to make android animations more solid and cohesive.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes