Git Product home page Git Product logo

androidscreenslidepager's Introduction

Android-ScreenSlidePager

Full screen slide pager to display images fetched from Internet by Picasso

demo


Indicator

The indicator at the bottom of ScreenSlidePager has been extracted as an aar. Your can add it to your dependecies to use it independently.

Gradle

compile 'com.liangfeizc:SlidePageIndicator:1.1.0@aar'

Maven

<dependency>
    <groupId>com.liangfeizc</groupId>
    <artifactId>SlidePageIndicator</artifactId>
    <version>1.1.0</version>
    <type>aar</type>
</dependency>

Usage

CirclePageIndicator and ViewPager shoud be used as child views of a Framelayout. But here we used merge instead, because the root view in any activity is a FrameLayout. You can use android:gravity to position the CirclePageIndicator and use app:indicator_spacing to adjust the spacing between two adjencent circle indicators.

<merge xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">
    <android.support.v4.view.ViewPager
        android:id="@+id/pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
    <com.liangfeizc.slidepageindicator.CirclePageIndicator
        android:id="@+id/indicator"
        android:gravity="bottom|center_horizontal"
        app:indicator_spacing="5dp"
        android:layout_marginBottom="20dp"
        android:layout_marginStart="20dp"
        android:layout_marginLeft="20dp"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</merge>

SlidePager

You can also use SlidePager by passing an array of picture urls to it.

Define an array of picture urls

private static final String[] IMAGES = new String[] {
    "http://img1.cache.netease.com/catchpic/B/B2/B2F274C1CCD5A89133261E6252A0C8E9.jpg",
    "http://img5.duitang.com/uploads/item/201408/09/20140809204759_CwtQN.jpeg",
    "http://img5q.duitang.com/uploads/item/201204/06/20120406151343_HefME.jpeg",
    "http://images.qianlong.com/mmsource/imghylanda/201108/25/21/7131919880274907937.jpg",
    "http://imgsrc.baidu.com/forum/pic/item/78370e46f91582056a63e576.jpg"

View pictures in a new activity

public void viewPictures(View view) {
    Intent intent = new Intent(this, SlidePagerActivity.class);
    intent.putExtra(SlidePagerActivity.EXTRA_TITLE, "堀北真希の写真");
    intent.putExtra(SlidePagerActivity.EXTRA_PICTURES, IMAGES);
    startActivity(intent);
}

dependencies

androidscreenslidepager's People

Contributors

liangfeidotme avatar

Watchers

James Cloos avatar David avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.