Example usage for android.util TypedValue COMPLEX_UNIT_PX

List of usage examples for android.util TypedValue COMPLEX_UNIT_PX

Introduction

In this page you can find the example usage for android.util TypedValue COMPLEX_UNIT_PX.

Prototype

int COMPLEX_UNIT_PX

To view the source code for android.util TypedValue COMPLEX_UNIT_PX.

Click Source Link

Document

#TYPE_DIMENSION complex unit: Value is raw pixels.

Usage

From source file:com.lovely3x.common.widgets.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));
                }//from w w  w .j  a v  a  2  s  .  c om
            }
        }
    }

}

From source file:com.cs.widget.tab.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(pager.getCurrentItem() == i ? 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   w  ww  . jav a2  s.c  o  m*/
            }
        }
    }

}

From source file:com.geeya.wifitv.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 == 0)
                tab.setTextColor(0xfffba534);
            else/*from  ww  w  .  j  a va 2s  .  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().toUpperCase(locale));
                }
            }
        }
    }

}

From source file:com.ryann10.pagerslidingtabstripsample.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 (tabTextColorStateList != null)
                tab.setTextColor(tabTextColorStateList);
            else/*  w ww  .  j  ava 2s. c  o m*/
                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.shenzhen.elson.selectordialoglib.SelectorDialog.java

private void createItems() {
    String[] titles = getOtherButtonTitles();
    if (titles != null) {
        for (int i = 0; i < titles.length; i++) {
            Button bt = new Button(getActivity());
            bt.setId(CANCEL_BUTTON_ID + i + 1);
            bt.setOnClickListener(this);
            bt.setBackgroundDrawable(getOtherButtonBg(titles, i));
            bt.setText(titles[i]);/*from www. j  a v  a  2 s .  co m*/
            bt.setTextColor(mAttrs.otherButtonTextColor);
            bt.setTextSize(TypedValue.COMPLEX_UNIT_PX, mAttrs.SelectorDialogTextSize);
            if (i > 0) {
                LinearLayout.LayoutParams params = createButtonLayoutParams();
                params.topMargin = mAttrs.otherButtonSpacing;
                mPanel.addView(bt, params);
            } else {
                mPanel.addView(bt);
            }
        }
    }
    Button bt = new Button(getActivity());
    bt.getPaint().setFakeBoldText(true);
    bt.setTextSize(TypedValue.COMPLEX_UNIT_PX, mAttrs.SelectorDialogTextSize);
    bt.setId(SelectorDialog.CANCEL_BUTTON_ID);
    bt.setBackgroundDrawable(mAttrs.cancelButtonBackground);
    bt.setText(getCancelButtonTitle());
    bt.setTextColor(mAttrs.cancelButtonTextColor);
    bt.setOnClickListener(this);
    LinearLayout.LayoutParams params = createButtonLayoutParams();
    params.topMargin = mAttrs.cancelButtonMarginTop;
    mPanel.addView(bt, params);

    mPanel.setBackgroundDrawable(mAttrs.background);
    mPanel.setPadding(mAttrs.padding, mAttrs.padding, mAttrs.padding, mAttrs.padding);
}

From source file:com.astuetz.PagerSlidingTabStripWithStyle.java

private void updateTabStyles() {

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

        View v = tabsContainer.getChildAt(i);

        v.setBackgroundResource(tabBackgroundResId);

        if (v instanceof RadioButton) {

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

            if (tabTextColorStateList != null) {
                tab.setTextColor(tabTextColorStateList);
            } else {
                tab.setTextColor(tabTextColor);
            }//www. ja  v  a 2  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.ipang.wansha.customview.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 == pager.getCurrentItem())
                tab.setTextColor(selectedTabTextColor);
            else//ww w.j  av 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().toUpperCase(locale));
                }
            }
        }
    }

}

From source file:littlechi.dyc.com.littlechi.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));
                }//  www .  j  av a 2 s .c  o m
            }
            if (i == currentPosition) {
                tab.setTextColor(selectedTabTextColor);
            }
        }
    }

}

From source file:com.elife.tzelife.indicator.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));
                }/*from   w  ww . ja  va2  s  .  com*/
            }
            if (i == selectedPosition) {
                tab.setTextColor(selectedTabTextColor);
                tab.setTextSize(selectedTabTextSize);
            }
        }
    }

}

From source file:com.wuyu.android.client.ui.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
            //by chenyg
            //            if (textAllCaps) {
            //               if (Build.VERSION.SDK_INT >= 14) { //Build.VERSION_CODES.ICE_CREAM_SANDWICH  API Level=14
            //                  tab.setAllCaps(true);
            //               } else {
            //                  tab.setText(tab.getText().toString().toUpperCase(locale));
            //               }
            //            }
        }/*  w  w  w.j  a v a 2 s.  c  o m*/
    }

}