Esempio n. 1
0
  // Activity Callbacks __________________________________________________________________________
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_activity);
    this.getSupportActionBar().setElevation(0);

    getWindow().setSharedElementExitTransition(new Slide());
    getWindow().setSharedElementEnterTransition(new Slide());

    tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs);
    viewPager = (ViewPager) findViewById(R.id.pager);
    viewPagerAdapter = new ContactsAdapter(this.getSupportFragmentManager(), this);

    viewPager.setAdapter(viewPagerAdapter);

    tabs.setShouldExpand(true);
    tabs.setTextColor(getResources().getColor(R.color.text_primary));
    tabs.setDividerColor(getResources().getColor(R.color.primary));
    tabs.setIndicatorColorResource(R.color.text_primary);
    tabs.setIndicatorHeight(7);

    // Bind the tabs to the ViewPager
    tabs.setViewPager(viewPager);

    // Start in Contacts Fragment
    viewPager.setCurrentItem(1);

    // Listener for slide animation on searchable selected
    setOnSearchableListener();

    // Configure custom-searchable UI
    // CustomSearchableInfo.setTransparencyColor(Color.parseColor("#0288D1"));
  }
  // region Lifecycle Methods
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_quick_return_facebook);
    ButterKnife.inject(this);

    mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager());

    // Set up the ViewPager with the sections adapter.
    mViewPager.setAdapter(mSectionsPagerAdapter);

    mTabs.setAllCaps(false);
    mTabs.setShouldExpand(true);
    //        mTabs.setTextSize(QuickReturnUtils.dp2px(this, 16));
    //        mTabs.setTabBackground(R.drawable.selector_bg_tab);
    mTabs.setIndicatorColorResource(R.color.steel_blue);
    mTabs.setIndicatorHeight(QuickReturnUtils.dp2px(this, 5));
    mTabs.setDividerColor(getResources().getColor(android.R.color.transparent));
    //        mTabs.setBackgroundColor(getResources().getColor(R.color.indigo));

    mTabs.setOnPageChangeListener(mTabsOnPageChangeListener);

    mTabs.setViewPager(mViewPager);

    // Set first tab selected
    mTabsLinearLayout = ((LinearLayout) mTabs.getChildAt(0));
    ImageButton ib = (ImageButton) mTabsLinearLayout.getChildAt(0);
    ib.setImageResource(R.drawable.ic_action_event_highlighted);
  }
Esempio n. 3
0
 private void setTabsValue() {
   tabs.setShouldExpand(true);
   tabs.setDividerColor(Color.TRANSPARENT);
   tabs.setUnderlineHeight((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, dm));
   tabs.setIndicatorHeight((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, dm));
   tabs.setTextSize((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 16, dm));
   tabs.setIndicatorColor(Color.parseColor("#45c01a"));
   tabs.setTabBackground(0);
 }
  private void setupSlidingTabs(ViewPager vpPager) {
    tabs = (PagerSlidingTabStrip) findViewById(R.id.slidingTabStrip);
    tabs.setViewPager(vpPager);
    tabs.setTextColor(getResources().getColor(R.color.TwitterBlue));

    tabs.setIndicatorColor(getResources().getColor(R.color.TwitterBlue));
    tabs.setDividerColor(getResources().getColor(android.R.color.white));
    tabs.setShouldExpand(true);
    tabs.setAllCaps(true);
  }
  private void setTabsValue() {
    dm = getResources().getDisplayMetrics();

    mPagerSlidingTabStrip.setDividerColor(Color.TRANSPARENT);
    mPagerSlidingTabStrip.setUnderlineHeight(
        (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, dm));
    mPagerSlidingTabStrip.setIndicatorHeight(
        (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, dm));
    mPagerSlidingTabStrip.setTextSize(
        (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 12, dm));
    mPagerSlidingTabStrip.setIndicatorColor(Color.parseColor("#45c01a"));
    mPagerSlidingTabStrip.setTabBackground(0);
  }
  // region Lifecycle Methods
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_quick_return_twitter);
    ButterKnife.bind(this);

    mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager());

    // Set up the ViewPager with the sections adapter.
    mViewPager.setAdapter(mSectionsPagerAdapter);

    mTabs.setAllCaps(false);
    mTabs.setShouldExpand(true);
    mTabs.setTextSize(QuickReturnUtils.dp2px(this, 18));
    mTabs.setUnderlineColor(getResources().getColor(R.color.gray8));
    mTabs.setUnderlineHeight(QuickReturnUtils.dp2px(this, 1));
    //        mTabs.setUnderlineHeight(1);
    //        mTabs.setTabBackground(R.drawable.selector_bg_tab);
    mTabs.setDividerColor(getResources().getColor(android.R.color.transparent));
    mTabs.setIndicatorColorResource(R.color.twitter_tab_underline);
    mTabs.setIndicatorHeight(QuickReturnUtils.dp2px(this, 4));
    mTabs.setOnPageChangeListener(mTabsOnPageChangeListener);
    mTabs.setViewPager(mViewPager);

    // Set first tab selected
    mTabsLinearLayout = ((LinearLayout) mTabs.getChildAt(0));

    for (int i = 0; i < mTabsLinearLayout.getChildCount(); i++) {
      TextView tv = (TextView) mTabsLinearLayout.getChildAt(i);

      if (i == 0) {
        tv.setTextColor(getResources().getColor(R.color.twitter_primary));
        tv.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/Roboto-Medium.ttf"));
      } else {
        tv.setTextColor(getResources().getColor(R.color.twitter_primary));
        tv.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/Roboto-Light.ttf"));
      }
    }
  }
Esempio n. 7
0
 /** mPagerSlidingTabStrip默认值配置 */
 private void initTabsValue() {
   // 底部游标颜色
   mPagerSlidingTabStrip.setIndicatorColor(Color.WHITE);
   // tab的分割线颜色
   mPagerSlidingTabStrip.setDividerColor(Color.TRANSPARENT);
   // tab背景
   mPagerSlidingTabStrip.setBackgroundColor(Color.parseColor("#ff259b2c"));
   // tab底线高度
   mPagerSlidingTabStrip.setUnderlineHeight(
       (int)
           TypedValue.applyDimension(
               TypedValue.COMPLEX_UNIT_DIP, 1, getResources().getDisplayMetrics()));
   // 游标高度
   mPagerSlidingTabStrip.setIndicatorHeight(
       (int)
           TypedValue.applyDimension(
               TypedValue.COMPLEX_UNIT_DIP, 5, getResources().getDisplayMetrics()));
   // 选中的文字颜色
   // mPagerSlidingTabStrip.setSelectedTextColor(Color.WHITE);
   // 正常文字颜色
   mPagerSlidingTabStrip.setTextColor(Color.WHITE);
 }