@Override
  public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mShareIntent = new Intent();
    mShareIntent.setAction(Intent.ACTION_SEND);
    mShareIntent.setType("text/plain");
    mShareIntent.putExtra(Intent.EXTRA_TEXT, "From me to you, this text is new.");

    tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs);
    ViewPager pager = (ViewPager) findViewById(R.id.pager);

    adapter = new MyPagerAdapter(getSupportFragmentManager());

    pager.setAdapter(adapter);

    final int pageMargin =
        (int)
            TypedValue.applyDimension(
                TypedValue.COMPLEX_UNIT_DIP, 4, getResources().getDisplayMetrics());
    pager.setPageMargin(pageMargin);

    tabs.setViewPager(pager);
  }
Esempio n. 2
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.view_pager, container, false);
    // Set the pager with an adapter
    ViewPager pager = (ViewPager) view.findViewById(R.id.pager);
    pager.setAdapter(
        new VideoPagerAdapter(
            getFragmentManager(), type, itemId, name, getActivity().getApplicationContext()));

    // Bind the widget to the adapter
    tabs = (PagerSlidingTabStrip) view.findViewById(R.id.tabs);
    tabs.setViewPager(pager);

    colorView = new ColorView(tabs, getActivity().getApplicationContext());
    colorView.changeColorTabs(user.getColor());

    return view;
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.worksmainactivity);

    tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs);
    pager = (ViewPager) findViewById(R.id.pager);
    adapter = new MyPagerAdapter(getSupportFragmentManager());

    pager.setAdapter(adapter);

    final int pageMargin =
        (int)
            TypedValue.applyDimension(
                TypedValue.COMPLEX_UNIT_DIP, 4, getResources().getDisplayMetrics());
    pager.setPageMargin(pageMargin);

    tabs.setViewPager(pager);
    Intent description = getIntent();
    int setpage = description.getIntExtra("descripn", 0);
    pager.setCurrentItem(setpage);

    changeColor(currentColor);
  }