Example usage for android.widget TextView setTextSize

List of usage examples for android.widget TextView setTextSize

Introduction

In this page you can find the example usage for android.widget TextView setTextSize.

Prototype

public void setTextSize(int unit, float size) 

Source Link

Document

Set the default text size to a given unit and value.

Usage

From source file:com.dashihui.afford.ui.widget.WdtPagerTabServerTime.java

private void updateTabStyles() {

    for (int i = 0; i < tabCount; i++) {

        View v = tabsContainer.getChildAt(i);

        v.setBackgroundResource(tabBackgroundResId);

        if (v instanceof TextView) {

            TextView tab = (TextView) v;
            tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
            tab.setTypeface(tabTypeface, tabTypefaceStyle);
            tab.setTextColor(tabTextColor);
            /*****************/
            //            tab.setBackgroundResource(R.drawable.servicetime_btn_label_bottom);

            // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a
            // pre-ICS-build
            if (textAllCaps) {
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
                    tab.setAllCaps(true);
                } else {
                    tab.setText(tab.getText().toString().toUpperCase(locale));
                }//ww  w  .j a  va2  s.c  o m
            }
        }
    }

}

From source file:com.desports.golf.view.PagerSlidingTabStrip.java

private void updateTabStyles() {

    for (int i = 0; i < tabCount; i++) {

        View v = tabsContainer.getChildAt(i);

        v.setBackgroundResource(tabBackgroundResId);

        if (v instanceof TextView) {

            TextView tab = (TextView) v;
            tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
            tab.setTypeface(tabTypeface, tabTypefaceStyle);
            tab.setTextColor(tabTextColor);

            // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a
            // pre-ICS-build
            if (textAllCaps) {
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
                    tab.setAllCaps(true);
                } else {
                    tab.setText(tab.getText().toString().toUpperCase(locale));
                }//w  w  w .  j a  va 2 s .  c om
            }

            if (i == selectedPosition) {
                tab.setTextColor(selectedTabTextColor);
            }
        }
    }

}

From source file:com.coolerfall.uiart.PagerSlidingTabStrip.java

/** update the style of number text */
private void updateNumTextStyle(TextView tab) {
    tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, mNumTextSize);
    tab.setTypeface(mTabTypeface, mTabTypefaceStyle);
    tab.setTextColor(mNumTextColor);/*from  ww  w.  j  a va  2 s .c o  m*/

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
        setBackgroud(tab);
    } else {
        setBackgroundJelly(tab);
    }
}

From source file:cn.mailchat.view.PagerSlidingTabStrip.java

private void updateTabStyles() {

    for (int i = 0; i < tabCount; i++) {
        RelativeLayout tabLayout = (RelativeLayout) tabsContainer.getChildAt(i);
        View v = tabLayout.getChildAt(0);

        v.setBackgroundResource(tabBackgroundResId);

        if (v instanceof TextView) {

            TextView tab = (TextView) v;
            tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
            tab.setTypeface(tabTypeface, tabTypefaceStyle);
            tab.setTextColor(tabTextColor);
            ////  w ww .  j  a v a 2  s. c  o  m
            // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a
            // pre-ICS-build
            // if (textAllCaps) {
            // if (Build.VERSION.SDK_INT >=
            // Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
            // tab.setAllCaps(true);
            // } else {
            // tab.setText(tab.getText().toString().toUpperCase(locale));
            // }
            // }
            if (i == selectedPosition) {
                tab.setTextColor(selectedTabTextColor);
            }
        }
    }

}

From source file:com.agenmate.lollipop.addedit.AddEditFragment.java

private void formatText(TextView textView, String string) {
    if (string != null) {
        textView.setText(MarkupUtils.fromHtml(string));
    }/*from   w  w  w. java 2s .  c o  m*/
    textView.setTextColor(Color.BLACK);
    textView.setTypeface(FontUtils.get(getActivity(), "Dudu"));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
}

From source file:com.coolerfall.uiart.PagerSlidingTabStrip.java

/** update the style of title text */
private void updateTabTextStyle(TextView tab, int color) {
    tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTabTextSize);
    tab.setTypeface(mTabTypeface, mTabTypefaceStyle);
    tab.setTextColor(color);//from  ww  w. ja v  a 2  s  .c om
}

From source file:com.cc.custom.uikit.PagerSlidingTabStrip.java

private void updateTabStyles() {

    for (int i = 0; i < tabCount; i++) {

        View v = tabsContainer.getChildAt(i);

        if (tabSelectedBackgroundResId > 0) {
            v.setBackgroundResource(tabBackgroundResId);
        }//ww  w  .  j av a 2 s. c o  m

        if (v instanceof TextView) {
            TextView tab = (TextView) v;
            tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
            tab.setTypeface(tabTypeface, tabTypefaceStyle);
            tab.setTextColor(tabTextColor);

            // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a
            // pre-ICS-build
            if (textAllCaps) {
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
                    tab.setAllCaps(true);
                } else {
                    tab.setText(tab.getText().toString().toUpperCase(locale));
                }
            }
        }
    }

}

From source file:com.example.linkagescroll.widget.PagerSlidingTabStrip.java

private void updateTabStyles() {

    for (int i = 0; i < tabCount; i++) {

        View v = tabsContainer.getChildAt(i);

        v.setBackgroundResource(tabBackgroundResId);

        if (v instanceof TextView) {

            TextView tab = (TextView) v;
            tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
            tab.setTypeface(tabTypeface, tabTypefaceStyle);
            if (i == currentPosition) {
                tab.setTextColor(tabTextSelectColor);
            } else {
                tab.setTextColor(tabTextColor);
            }/*from  w  ww  . ja v  a2  s. c  om*/
            // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a
            // pre-ICS-build
            if (textAllCaps) {
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
                    tab.setAllCaps(true);
                } else {
                    tab.setText(tab.getText().toString().toUpperCase(locale));
                }
            }
        }
    }

}

From source file:com.collcloud.frame.viewpager.PagerSlidingTabStrip.java

public void updateTabStyles(int curPosition) {

    for (int i = 0; i < tabCount; i++) {

        View v = tabsContainer.getChildAt(i);

        v.setBackgroundResource(tabBackgroundResId);
        if (v instanceof RelativeLayout) {
            RelativeLayout rL = (RelativeLayout) v;
            TextView tab = (TextView) rL.getChildAt(0);
            tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
            tab.setTypeface(tabTypeface, tabTypefaceStyle);

            if (curPosition == i) {
                tab.setTextColor(pstsTextHighLightColor);
            } else {
                tab.setTextColor(tabTextColor);
            }/* w  w w. j a  va2 s. c  o m*/

            // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a
            // pre-ICS-build
            if (textAllCaps) {
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
                    tab.setAllCaps(true);
                } else {
                    tab.setText(tab.getText().toString().toUpperCase(locale));
                }
            }
        }
    }

}

From source file:com.manning.androidhacks.hack017.CreateAccountAdapter.java

private TextView createErrorView(String key) {
    TextView ret = new TextView(mContext);
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,
            LayoutParams.WRAP_CONTENT);//w  w  w . ja v  a  2s  . co m
    params.topMargin = 10;
    params.bottomMargin = 10;
    ret.setLayoutParams(params);
    ret.setTextColor(Color.RED);
    ret.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10);

    HashMap<String, String> errors = mAccount.getErrors();
    if (errors != null && errors.containsKey(key)) {
        ret.setText(errors.get(key));
        ret.setVisibility(View.VISIBLE);
    } else {
        ret.setVisibility(View.INVISIBLE);
    }

    return ret;
}