library/src/main/java/com/ogaclejapan/smarttablayout/SmartTabLayout.java
/**
     * Create a default view to be used for tabs. This is called if a custom tab view is not set via
     * {@link #setCustomTabView(int, int)}.
     */
Create a default view to be used for tabs. This is called if a custom tab view is not set via
#setCustomTabView(int, int).
Create a default view to be used for tabs . This is called if a custom tab view is not set via #setCustomTabView ( int int ) .
protected TextView createDefaultTabView(CharSequence title) {
        TextView textView = new TextView(getContext());
        textView.setGravity(Gravity.CENTER);
        textView.setTextColor(tabViewTextColors);
        textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabViewTextSize);
        if(tabViewTextAllBold){
            textView.setTypeface(getTypeface(textViewTypefaceResId),Typeface.BOLD);
        }else {
            textView.setTypeface(getTypeface(textViewTypefaceResId),Typeface.NORMAL);
        }
        textView.setText(title);
        textView.setLayoutParams(new LinearLayout.LayoutParams(
                LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT));
        if (tabViewBackgroundResId != NO_ID) {
            textView.setBackgroundResource(tabViewBackgroundResId);
        } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            TypedValue outValue = new TypedValue();
            getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground,
                    outValue, true);
            textView.setBackgroundResource(outValue.resourceId);
        }
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
            textView.setAllCaps(tabViewTextAllCaps);
        }
        textView.setPadding(
                tabViewTextHorizontalPadding, 0,
                tabViewTextHorizontalPadding, 0);
        if (tabViewTextMinWidth > 0) {
            textView.setMinWidth(tabViewTextMinWidth);
        }
        return textView;
    }
protected TextView createDefaultTabView ( CharSequence title ) { TextView textView = new TextView ( getContext ( ) ) ; textView . setGravity ( Gravity . CENTER ) ; textView . setTextColor ( tabViewTextColors ) ; textView . setTextSize ( TypedValue . COMPLEX_UNIT_PX , tabViewTextSize ) ; if ( tabViewTextAllBold ) { textView . setTypeface ( getTypeface ( textViewTypefaceResId ) , Typeface . BOLD ) ; } else { textView . setTypeface ( getTypeface ( textViewTypefaceResId ) , Typeface . NORMAL ) ; } textView . setText ( title ) ; textView . setLayoutParams ( new LinearLayout . LayoutParams ( LinearLayout . LayoutParams . WRAP_CONTENT , LinearLayout . LayoutParams . MATCH_PARENT ) ) ; if ( tabViewBackgroundResId != NO_ID ) { textView . setBackgroundResource ( tabViewBackgroundResId ) ; } else if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . HONEYCOMB ) { TypedValue outValue = new TypedValue ( ) ; getContext ( ) . getTheme ( ) . resolveAttribute ( android . R . attr . selectableItemBackground , outValue , true ) ; textView . setBackgroundResource ( outValue . resourceId ) ; } if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . ICE_CREAM_SANDWICH ) { textView . setAllCaps ( tabViewTextAllCaps ) ; } textView . setPadding ( tabViewTextHorizontalPadding , 0 , tabViewTextHorizontalPadding , 0 ) ; if ( tabViewTextMinWidth > 0 ) { textView . setMinWidth ( tabViewTextMinWidth ) ; } return textView ; }
Create a default view to be used for tabs.
Create a default view to be used for tabs .
//textView.setTypeface(Typeface.DEFAULT_BOLD); //textView.setText(ifBoldText(tabViewTextAllBold, title.toString())); //textView.setText(ifBoldText(tabViewTextAllBold, (title != null ? title.toString() : null))); // If we're running on Honeycomb or newer, then we can use the Theme's // selectableItemBackground to ensure that the View has a pressed state // If we're running on ICS or newer, enable all-caps to match the Action Bar tab style