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.nkdroid.tabpager.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);
            }//  w  w w  . j  ava2s.  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_title.setAllCaps(true);
                } else {
                    tab_title.setText(tab_title.getText().toString().toUpperCase(locale));
                }
            }
        }
    }
}

From source file:base.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  w w  .  jav a2s .  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.witmoon.xmb.ui.widget.PagerSlidingTabStrip.java

private void updateTabStyles() {

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

        View v = tabsContainer.getChildAt(i);
        View vs = null;//w  w  w . ja v a  2 s.  c o m
        v.setBackgroundResource(tabBackgroundResId);

        if (v instanceof LinearLayout) {
            vs = ((LinearLayout) v).getChildAt(0);
        }

        if (v instanceof LinearLayout) {
            v = ((LinearLayout) v).getChildAt(1);
        }

        if (v instanceof TextView) {

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

            // 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 == selectedTabPosition) {
                tab.setBackgroundColor(selectedTabBagC);
                tab.setTextColor(selectedTabTextColor);
                tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, selectedTabTextSize);
            }
        }
        if (null != vs) {
            if (vs instanceof ImageView) {
                ImageView ico = (ImageView) vs;
                if (i == 0) {
                    ico.setImageResource(icoColor);
                } else {
                    ico.setImageResource(icoColor1);
                }

                // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a
                // pre-ICS-build
                if (i == selectedTabPosition) {
                    ico.setImageResource(selectedIcoColor);
                    if (i == 0) {
                        ico.setImageResource(selectedIcoColor);
                    } else {
                        ico.setImageResource(selectedIcoColor1);
                    }

                }
            }

        }
    }
}

From source file:com.waz.zclient.pages.main.participants.ParticipantHeaderFragment.java

@Override
public void participantsUpdated(UsersList participants) {
    subHeader.setText(getResources().getQuantityString(R.plurals.participants__sub_header_xx_people,
            participants.size(), participants.size()));
    subHeader.setTextSize(TypedValue.COMPLEX_UNIT_PX,
            getResources().getDimension(R.dimen.wire__text_size__small));
    subHeader.setOnClickListener(null);/*from w  w  w. j a v  a2 s .c om*/

    // Hide header bottom border
    bottomBorder.setVisibility(View.GONE);

    new Handler().post(new Runnable() {
        @Override
        public void run() {
            if (getView() != null && getContainer() != null) {
                final int height = getView().getMeasuredHeight();
                getControllerFactory().getConversationScreenController().setParticipantHeaderHeight(height);
            }
        }
    });
}

From source file:com.lee.main.view.pager.tab.PagerSlidingTabStrip.java

private void updateTabColor(int position) {
    int pos = position != -1 ? position : currentPosition;
    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 == pos) {
                tab.setTextColor(0xFFFF3035);
            }/*from   w w  w. j  a  v a2  s  .c om*/
        }
    }
}

From source file:com.youqu.piclbs.util.SlidingTabLayout.java

private void updateTabStyles() {
    for (int i = 0; i < mTabCount; i++) {
        View v = mTabsContainer.getChildAt(i);
        //            v.setPadding((int) mTabPadding, v.getPaddingTop(), (int) mTabPadding, v.getPaddingBottom());
        TextView tv_tab_title = (TextView) v.findViewById(R.id.tv_tab_title);
        if (tv_tab_title != null) {
            tv_tab_title.setTextColor(i == mCurrentTab ? mTextSelectColor : mTextUnselectColor);
            tv_tab_title.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTextSize);
            tv_tab_title.setPadding((int) mTabPadding, 0, (int) mTabPadding, 0);
            if (mTextAllCaps) {
                tv_tab_title.setText(tv_tab_title.getText().toString().toUpperCase());
            }/*from  w  w  w  .ja v  a  2 s  . c o  m*/

            if (mTextBold) {
                tv_tab_title.getPaint().setFakeBoldText(mTextBold);
            }
        }
    }
}

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));
                }//from  w w w. ja v  a2 s  .c o  m
            }
        }
    }

}

From source file:org.smart.library.widget.PagerSlidingTabStrip.java

private void updateTabStyles(int index) {
    View v = tabsContainer.getChildAt(index);

    v.setBackgroundResource(tabBackgroundResId);

    if (v instanceof TextView) {

        TextView tab = (TextView) v;// w  w w  .j a v a2 s.  co m
        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 (index == selectedPosition) {
            tab.setTextColor(selectedTabTextColor);
        }
    }
}

From source file:dk.dr.radio.diverse.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   ww  w .  j av a 2 s  . c o m*/
              }
          }
      }

  }

From source file:com.example.view.astuetz.PagerSlidingTabStrip.java

@SuppressLint("NewApi")
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;
            android.widget.LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(0,
                    LayoutParams.MATCH_PARENT, 1f);
            tab.setLayoutParams(layoutParams);
            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 v a 2 s. c  o m
            }
        }
    }

}