示例#1
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 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"));
      }
    }
  }
示例#4
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);
 }