Coder Social home page Coder Social logo

flipviewpager's Introduction

FlipViewPager

FlxxBoardのようなページ捲りインタフェースを実現できるViewPagerです。

sample-apk runtime screenshot.

使い方

ViewPagerをベースに作ったウィジェットなので、基本的にViewPagerと同じ使い方です。 詳しくはサンプルプロジェクトを参照してください。

activity(.java)

this.pager = (FlipViewPager)findViewById(R.id.flipviewpager);
this.pager.setAdapter(new PagerAdapter() {
	private final LayoutInflater inflater;
	{
        this.inflater = (LayoutInflater) MainActivity.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	}
	
	@Override public boolean isViewFromObject(View arg0, Object arg1) {
		return arg0 == arg1;
	}
	
	@Override public int getCount() {
		return 10;
	}
	
	@Override public Object instantiateItem(ViewGroup container, int position) {
		final FrameLayout v = (FrameLayout) inflater.inflate(R.layout.activity_main_pager_item, null);
		
		final TextView  text  = (TextView )v.findViewById(R.id.text);
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < 100; i++) {
			sb.append("this page position is " + position + ". ");
		}
		text.setText(sb.toString());
		
		final ImageView image = (ImageView)v.findViewById(R.id.image);
		
		container.addView(v);
		return v;
	}
	
	@Override public void destroyItem(ViewGroup container, int position, Object object) {
		//TODO 
	}
});

layout(.xml)

<LinearLayout 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"
    android:orientation="vertical"
    tools:context=".MainActivity" >

    <t3.giftbook.util.FlipViewPager
		android:id="@+id/flipviewpager"
		android:layout_width="match_parent"
		android:layout_height="match_parent"
	/>

</LinearLayout>

flipviewpager's People

Contributors

mkt-tokoi avatar

Stargazers

Nicholas Sean avatar Ritik kumar avatar Wajahat Karim avatar Aspirer avatar Claude Hangui avatar  avatar Pranav Lathigara avatar gzbleu avatar naz avatar SodiDav avatar Yunchuan Zhang avatar  avatar YinYong avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

cnbleu

flipviewpager's Issues

setCurrentItem(int pos)

Wrong splicing between left half screen and right half screen during sliding

use setCurrentItem

Prevent loading next page

I'd like to prevent loading of next post...once the flip is completed, I wish to have a progressbar which loads while data is being loaded

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.