package com.liuguangqiang.tablayout.sample;

import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Toast;

import com.liuguangqiang.multilayout.widget.Page;
import com.liuguangqiang.multilayout.widget.MultiLayout;
import com.liuguangqiang.multilayout.widget.OnPageChangedListener;

import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;

public class MainActivity extends ActionBarActivity {

    @InjectView(R.id.tabLayout)
    MultiLayout multiLayout;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ButterKnife.inject(this);
        initViews();
    }

    private void initViews() {
        multiLayout.addPage(R.layout.layout_tab1);
        multiLayout.addPage(R.layout.layout_tab2);

        Page layoutItem = new Page(this);
        View view = LayoutInflater.from(this).inflate(R.layout.layout_tab3, null);
        layoutItem.setContent(view);
        multiLayout.addPage(layoutItem);
        multiLayout.setOnPageChangedListener(new OnPageChangedListener() {
            @Override
            public void onOpen(int position) {
                Log.i("MultiLayout", "onOpen:" + position);
//                Toast.makeText(getApplicationContext(), "open:" + position, Toast.LENGTH_LONG).show();
            }

            @Override
            public void onClose(int position) {
                Log.i("MultiLayout", "onClose:" + position);
//                Toast.makeText(getApplicationContext(), "close:" + position, Toast.LENGTH_LONG).show();
            }

            @Override
            public void onFinished(int position, boolean isOpen) {
                Log.i("MultiLayout", String.format("onFinished:p-%s,b-%s", position, isOpen));
//                Toast.makeText(getApplicationContext(), "onFinished:" + position, Toast.LENGTH_LONG).show();
            }
        });
    }

    @OnClick(R.id.btn_tab1)
    public void onClickTab1() {
        multiLayout.open(0);
    }

    @OnClick(R.id.btn_tab2)
    public void onClickTab2() {
        multiLayout.open(1);
    }

    @OnClick(R.id.btn_tab3)
    public void onClickTab3() {
        multiLayout.open(2);
    }

}

@@ -204,87 +204,8 @@
 ew;%0A
-import android.widget.Toast;%0A%0Aimport com.liuguangqiang.multilayout.widget.Page;
 %0Aimp
@@ -324,16 +324,66 @@
 istener;
+%0Aimport com.liuguangqiang.multilayout.widget.Page;
 %0A%0Aimport
@@ -978,32 +978,81 @@
 new Page(this);%0A
+        layoutItem.setGravity(Page.Gravity.TOP);%0A
         View vie
@@ -1404,113 +1404,8 @@
 n);%0A
-//                Toast.makeText(getApplicationContext(), %22open:%22 + position, Toast.LENGTH_LONG).show();%0A
     
@@ -1550,424 +1550,8 @@
 n);%0A
-//                Toast.makeText(getApplicationContext(), %22close:%22 + position, Toast.LENGTH_LONG).show();%0A            %7D%0A%0A            @Override%0A            public void onFinished(int position, boolean isOpen) %7B%0A                Log.i(%22MultiLayout%22, String.format(%22onFinished:p-%25s,b-%25s%22, position, isOpen));%0A//                Toast.makeText(getApplicationContext(), %22onFinished:%22 + position, Toast.LENGTH_LONG).show();%0A
     

Update sample.