content: package com.xiaochao.lclableview;
  
  import android.content.Intent;
  import android.net.Uri;
  import android.os.Bundle;
  import android.support.design.widget.TabLayout;
  import android.support.v4.app.Fragment;
  import android.support.v4.app.FragmentManager;
  import android.support.v4.app.FragmentPagerAdapter;
  import android.support.v4.view.ViewPager;
  import android.support.v7.app.AppCompatActivity;
  import android.support.v7.widget.Toolbar;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.widget.Toast;
  
  import java.util.ArrayList;
  import java.util.List;
  
  public class MainActivity extends AppCompatActivity {
  
  
      private SectionsPagerAdapter mSectionsPagerAdapter;
  
      private ViewPager mViewPager;
      private List<Fragment> mFragmentList=new ArrayList<Fragment>();
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          mFragmentList.add(new Blank1Fragment());
          mFragmentList.add(new Blank2Fragment());
          mFragmentList.add(new Blank3Fragment());
          Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
          setSupportActionBar(toolbar);
          mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
          mViewPager = (ViewPager) findViewById(R.id.container);
          mViewPager.setAdapter(mSectionsPagerAdapter);
  
          TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
          tabLayout.setupWithViewPager(mViewPager);
  
  
      }
  
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          getMenuInflater().inflate(R.menu.menu_main, menu);
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          int id = item.getItemId();
  
          if (id == R.id.action_settings) {
              Uri uri = Uri.parse("https://github.com/80945540/LcLableView");
              Intent it = new Intent(Intent.ACTION_VIEW, uri);
              startActivity(it);
              return true;
          }
  
          return super.onOptionsItemSelected(item);
      }
  
      public class SectionsPagerAdapter extends FragmentPagerAdapter {
  
          public SectionsPagerAdapter(FragmentManager fm) {
              super(fm);
          }
  
          @Override
          public Fragment getItem(int position) {
  
              return mFragmentList.get(position);
          }
  
          @Override
          public int getCount() {
              return 3;
          }
  
          @Override
          public CharSequence getPageTitle(int position) {
              switch (position) {
                  case 0:
                      return "浮嵌";
                  case 1:
                      return "实边";
                  case 2:
                      return "空边";
              }
              return null;
          }
      }
  }
  