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:yjbo.yy.ynewsrecycle.mainutil.PSFirst.java

private void updateTabStyles() {
    for (int i = 0; i < mTabCount; i++) {
        View v = mTabsContainer.getChildAt(i);
        //            v.setBackgroundResource(mTabBackgroundResId);
        if (i == mTabCount - 1) {//??
            float dimension = mcontext.getResources().getDimension(R.dimen.text_50);
            v.setPadding(mTabPadding, v.getPaddingTop(), (int) dimension, v.getPaddingBottom());
        } else {//  w w  w.j  av  a  2 s . c om
            v.setPadding(mTabPadding, v.getPaddingTop(), mTabPadding, v.getPaddingBottom());
        }
        TextView tab_title = (TextView) v.findViewById(R.id.psts_tab_title);
        if (tab_title != null) {
            tab_title.setTypeface(mTabTextTypeface, mTabTextTypefaceStyle);
            tab_title.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTabTextSize);
            // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a
            // pre-ICS-build
            if (isTabTextAllCaps) {
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
                    tab_title.setAllCaps(true);
                } else {
                    tab_title.setText(tab_title.getText().toString()
                            .toUpperCase(getResources().getConfiguration().locale));
                }
            }
            if (tab_title.isSelected()) {
                //    LogUtils.i("------" + i);
                //  tab_title.setTextColor(Color.parseColor("#ffffff"));
                tab_title.setTextColor(Color.parseColor("#29b4ed"));
                this.setIndicatorHeight((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 0,
                        getResources().getDisplayMetrics()));
                //  tab_title.setTextSize(TypedValue.COMPLEX_UNIT_PX,mcontext.getResources().getDimension(R.dimen.honor_card_awesome_item_head_size));
                //                    tab_title.setTextSize(16);
                //                    TextPaint tp = tab_title.getPaint();
                //                    tp.setFakeBoldText(true);
                tab_title.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTabTextSize);
            } else {
                //    LogUtils.i("------" + i);

                this.setIndicatorHeight((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 0,
                        getResources().getDisplayMetrics()));
                //                    tab_title.setTextColor(getResources().getColor(R.color.tab_default_text));
                tab_title.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTabTextSize);
                tab_title.setTextColor(Color.parseColor("#666666"));
                //                    TextPaint tp = tab_title.getPaint();
                //                    tp.setFakeBoldText(false);
            }
        }
    }
}

From source file:com.zhongsou.souyue.circle.view.PagerSlidingTabStrip.java

public void updateSelectedTextColor(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.setTextColor(tabTextColor);
            //add by zhangyanwei update text size
            tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
        }//from   w ww  .  java  2s .  com
    }

    View v = tabsContainer.getChildAt(position);
    if (v instanceof TextView) {
        //            if(isYaowen){
        //                ((TextView) v).setTextColor(tabTextSelectedColor);
        //            }else{
        ((TextView) v).setTextColor(tabTextSelectedColor);
        //            }
        //add by zhangyanwei update text size
        ((TextView) v).setTextSize(TypedValue.COMPLEX_UNIT_PX,
                tabTextSelectedSize == 0 ? tabTextSize : tabTextSelectedSize);
    }
}

From source file:com.sflib.CustomView.baseview.RoundRecPagerSlidingTabStrip.java

private void updateTabStyles() {

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

        View v = tabsContainer.getChildAt(i);

        v.setBackgroundResource(tabBackgroundResId);

        TextView tab;//from  w w  w .j  a  va 2  s  . co m
        if (v instanceof TextView) {
            tab = (TextView) v;
        } else if (v instanceof RelativeLayout) {
            tab = (TextView) v.findViewById(R.id.title);
        } else {
            continue;
        }

        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.ashish.routofy.PagerSlidingTabStrip.java

private void updateTabStyles() {
    for (int i = 0; i < tabCount; i++) {
        View v = tabsContainer.getChildAt(i);
        v.setBackgroundResource(tabBackgroundResId);
        v.setPadding(tabPadding, v.getPaddingTop(), tabPadding, v.getPaddingBottom());
        TextView tab_title = (TextView) v.findViewById(R.id.psts_tab_title);

        if (tab_title != null) {
            tab_title.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
            // 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_title.setAllCaps(true);
                } else {
                    tab_title.setText(tab_title.getText().toString().toUpperCase(locale));
                }//  w ww  .  ja  v a 2s .  com
            }
        }
    }
}

From source file:net.coding.program.third.MyPagerSlidingTabStrip.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 av a 2 s. c  o m
            }
        }
    }

}

From source file:net.coding.program.common.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);
            if (i == 0) {
                tab.setTextColor(getTextSelectedColor());
            }/*from   www  .  ja v  a 2  s .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.pranavpandey.smallapp.view.PagerSlidingTabStrip.java

private void updateTabStyles() {
    for (int i = 0; i < tabCount; i++) {
        View v = tabsContainer.getChildAt(i);
        v.setBackgroundResource(tabBackgroundResId);
        TextView tab_title = (TextView) v.findViewById(R.id.tab_title);

        if (tab_title != null) {
            tab_title.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
            tab_title.setTypeface(tabTypeface,
                    pager.getCurrentItem() == i ? tabTypefaceSelectedStyle : tabTypefaceStyle);
            if (tabTextColor != null) {
                tab_title.setTextColor(tabTextColor);
            }//from w  ww. 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_title.setAllCaps(true);
                } else {
                    tab_title.setText(tab_title.getText().toString().toUpperCase(locale));
                }
            }
        }
    }
}

From source file:com.ghkjgod.lightnovel.component.PagerSlidingTabStrip.java

private void updateTabStyles() {
    for (int i = 0; i < tabCount; i++) {
        View v = tabsContainer.getChildAt(i);
        v.setBackgroundResource(tabBackgroundResId);
        v.setPadding(tabPadding, v.getPaddingTop(), tabPadding, v.getPaddingBottom());
        TextView tab_title = (TextView) v.findViewById(R.id.tab_title);

        if (tab_title != null) {
            tab_title.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
            tab_title.setTypeface(tabTypeface,
                    pager.getCurrentItem() == i ? tabTypefaceSelectedStyle : tabTypefaceStyle);
            if (tabTextColor != null) {
                tab_title.setTextColor(tabTextColor);
            }//  www. ja  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_title.setAllCaps(true);
                } else {
                    tab_title.setText(tab_title.getText().toString().toUpperCase(locale));
                }
            }
        }
    }
}

From source file:com.layer.messenger.makemoji.MakeMojiAtlasComposer.java

private void applyStyle() {
    setEnabled(mEnabled);/*from   w ww . j a  va 2 s  .  com*/

    mMessageEditText.setTextColor(mTextColor);
    mMessageEditText.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTextSize);
    EditTextUtil.setCursorDrawableColor(mMessageEditText, mCursorColor);
    EditTextUtil.setUnderlineColor(mMessageEditText, mUnderlineColor);
    applyTypeface();

    ColorStateList list = getResources()
            .getColorStateList(com.layer.atlas.R.color.atlas_message_composer_attach_button);
    Drawable d = DrawableCompat.wrap(mAttachButton.getDrawable().mutate());
    DrawableCompat.setTintList(d, list);
    mAttachButton.setImageDrawable(d);
}

From source file:com.devbrackets.android.recyclerext.widget.FastScroll.java

/**
 * Sets the text size of the popup bubble via the {@code dimeRes}
 * This can also be specified with {@code re_bubble_text_size} in xml
 *
 * @param dimenRes The dimension resource for the text size
 *//*from   w w  w  .j  a  va2s.  c o m*/
public void setTextSize(@DimenRes int dimenRes) {
    bubble.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimensionPixelSize(dimenRes));
}