Example usage for android.widget TextView getText

List of usage examples for android.widget TextView getText

Introduction

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

Prototype

@ViewDebug.CapturedViewProperty
public CharSequence getText() 

Source Link

Document

Return the text that TextView is displaying.

Usage

From source file:com.huahan.hhbaseutils.view.PagerSlidingTabStrip.java

private void updateTabStyles() {

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

        View v = tabsContainer.getChildAt(i);
        v.setBackgroundResource(tabBackgroundResId);
        if (!shouldExpand) {
            v.setLayoutParams(defaultTabLayoutParams);
            v.setPadding(tabPadding, 0, tabPadding, 0);
        }/*from  w w  w  .  j a  va  2 s  .  c  o  m*/
        //
        // v.setLayoutParams(defaultTabLayoutParams);
        // v.setBackgroundResource(tabBackgroundResId);
        // if (shouldExpand) {
        // v.setPadding(0, 0, 0, 0);
        // } else {
        // v.setPadding(tabPadding, 0, tabPadding, 0);
        // }

        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));
                }
            }

            if (i == selectedPosition) {
                tab.setTextColor(selectedTabTextColor);
                // tab.setTextSize(TypedValue.COMPLEX_UNIT_PX,
                // selectedTabTextSize);
            }
        }
    }

}

From source file:com.carinsurance.pagerslidingtabstrip.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);
            // tab.setTextColor(Color.parseColor("#00a2d0"));

            // 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 ww  w .ja v  a2s.  c om
            }
        }
    }

}

From source file:com.anniu.shandiandaojia.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;
            //TODO tab?   ????
            tab.setTextSize(TypedValue.COMPLEX_UNIT_SP, tabTextSize);
            tab.setTypeface(tabTypeface, tabTypefaceStyle);
            tab.setTextColor(tabTextColor);

            if (i == currentPosition) {
                tab.setTextColor(tabTextColorSelected);
            } else {
                tab.setTextColor(tabTextColor);
            }//from  w  w w. j  a va 2s .  c  om

            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.astuetz.PagerSlidingTitleIconTabStrip.java

private void updateTabStyles() {

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

        View v = tabsContainer.getChildAt(i);

        v.setBackgroundResource(tabBackgroundResId);

        if (v instanceof LinearLayout) {
            if (((LinearLayout) v).getChildCount() > 1) {
                v = ((LinearLayout) v).getChildAt(1);
            } else {
                v = ((LinearLayout) v).getChildAt(0);
            }//  www . j  av a2s.  c o m
        }

        if (v instanceof TextView) {
            TextView tab = (TextView) v;
            tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
            tab.setTypeface(tabTypeface, tabTypefaceStyle);
            if (i == currentPageSelected) {
                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:android.improving.utils.views.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);

            animTextColor(tab, selectedTabTextColor, 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 av  a  2  s.  co  m*/
            }
            if (i == selectedPosition) {
                //               tab.setTextColor(selectedTabTextColor);
                animTextColor(tab, tabTextColor, selectedTabTextColor);
                tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, selectedTabTextSize);
            }
        }
    }

}

From source file:cc.wudoumi.framework.views.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);
            updateTabTextSize(tab);//from  w  ww  . j  av a2  s  . c  o m
            tab.setTypeface(tabTypeface, tabTypefaceStyle);
            //tab.setTextColor(textColor);

            // 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.yh.myapplication.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, unSelectTextsize);
            tab.setTypeface(tabTypeface, tabTypefaceStyle);
            tab.setTextColor(tabTextColor);
            // tab.setBackgroundColor(color);
            // 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 w w w  . ja  v a2  s. c o  m
            }

            if (i == selectedPosition) {
                tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, selectTextSize);
                tab.setTextColor(selectedTextColor);
                if (roundBorder) {
                    //                        if (i == 0) {
                    //                            tab.setBackgroundResource(R.drawable.shape_food_mgr_titile_tab_left);
                    //                        } else if (i == tabCount - 1) {
                    //                            tab.setBackgroundResource(R.drawable.shape_food_mgr_titile_tab_right);
                    //                        } else {
                    //                            tab.setBackgroundResource(R.drawable.shape_food_mgr_titile_tab_middle);
                    //                        }
                }

            }
        }
    }

}

From source file:cn.qiuc.org.igoogleplay.lib.pagerslidingtab.PagerSlidingTab.java

private void updateTabStyles() {

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

        View v = tabsContainer.getChildAt(i);

        v.setLayoutParams(defaultTabLayoutParams);
        v.setBackgroundResource(tabBackgroundResId);
        if (shouldExpand) {
            v.setPadding(0, 0, 0, 0);//from  w w  w .j a  v  a2  s  .  c  o  m
        } else {
            v.setPadding(tabPadding, 0, tabPadding, 0);
        }

        if (v instanceof TextView) {

            TextView tab = (TextView) v;
            tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
            tab.setTypeface(tabTypeface, tabTypefaceStyle);
            tab.setTextColor(
                    i == 0 ? getResources().getColor(R.color.slidingtab_indicatorcolor) : 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.ccj.tabpager.view.ZDMSlidingTab.java

private void updateTabStyles(int position) {

    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 == position) {
                tab.setTextColor(selectedTextColor);
            } else {
                tab.setTextColor(tabTextColor);
            }// ww  w  .  j av 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));
                }
            }
        }
    }

}

From source file:com.gmobi.poponews.widget.PagerSlidingTabStrip.java

private void updateTabStyles() {

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

        View v = tabsContainer.getChildAt(i);

        //v.setBackgroundResource(tabBackgroundResId);
        //v.setBackgroundColor(getResources().getColor(R.color.main_tab_bg));
        if (v instanceof TextView) {

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

            if (i == currentPosition)
                tab.setTextColor(tabSelectTextColor);
            else//from   w  ww .  j  a v  a  2 s . c  om
                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());
                }
            }
        }
    }

}