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.allwinner.theatreplayer.launcher.activity.LaunchActivity.java

private void addTopTextView(String title, int count, int index) {
    if (mTopTextLayout == null) {
        mTopTextLayout = (LinearLayout) findViewById(R.id.top_text_layout);
    }//from w w w  .ja v  a  2s. com
    if (mTopFocusLine == null) {
        mTopFocusLine = (ImageView) findViewById(R.id.top_focus_line);
    }
    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
            LayoutParams.WRAP_CONTENT);
    layoutParams.leftMargin = (int) getResources().getDimensionPixelSize(R.dimen.navigation_home_to_left);
    LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
            LayoutParams.WRAP_CONTENT);
    layoutParams2.leftMargin = (int) getResources().getDimensionPixelSize(R.dimen.navigation_home_margin_left);
    if (mTopTextView == null) {
        mTopTextView = new TextView[count];
    }

    TextView textView = new TextView(this);
    textView.setText(title);
    //      if (index == 0) {
    //         textView.setTextColor(getResources().getColor(R.color.blue));
    //         mTopTextLayout.addView(textView, layoutParams);
    //      } else {

    textView.setTextColor(getResources().getColor(R.color.white));
    if (mPageCount < 5) {
        mTopTextLayout.addView(textView, layoutParams2);
    } else {
        mTopTextLayout.addView(textView, layoutParams);
    }
    //      }
    textView.setTextSize(TypedValue.COMPLEX_UNIT_PX,
            getResources().getDimensionPixelSize(R.dimen.view_page_text_size));
    mTopTextView[index] = textView;
    if (mTopTextView[index] != null) {
        mTopTextView[index].setTag(index);
        mTopTextView[index].setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View arg0) {
                int tag = (Integer) arg0.getTag();
                mViewPager.setCurrentItem(tag);

            }
        });
    }
}

From source file:com.facebook.LikeView.java

private void initializeSocialSentenceView(Context context) {
    socialSentenceView = new TextView(context);
    socialSentenceView.setTextSize(TypedValue.COMPLEX_UNIT_PX,
            getResources().getDimension(R.dimen.com_facebook_likeview_text_size));
    socialSentenceView.setMaxLines(2);/*from w  w w .  j  a va  2s .  co  m*/
    socialSentenceView.setTextColor(foregroundColor);
    socialSentenceView.setGravity(Gravity.CENTER);

    LinearLayout.LayoutParams socialSentenceViewLayout = new LinearLayout.LayoutParams(
            LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
    socialSentenceView.setLayoutParams(socialSentenceViewLayout);
}

From source file:wm.xmwei.ui.view.indicator.PagerSlidingTabIndicator.java

private void setTabTextColor(int position, boolean isSelect) {
    TextView selectView = ((TextView) tabsContainer.getChildAt(position));
    if (isSelect) {
        selectView.setTextColor(getResources().getColor(R.color.v_title_bg));
        if (textChangeSizeOnScroll) {
            selectView.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabSelectedTextSize);
        }//from w  ww .j ava2 s.c  o  m
    } else {
        selectView.setTextColor(getResources().getColor(R.color.tabblack));
        if (textChangeSizeOnScroll) {
            selectView.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
        }
    }

}

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

/**
 * Retrieves the xml attributes associated with the popup bubble.
 * This includes the drawable, tint color, alignment, font options, etc.
 *
 * @param typedArray The array of attributes to use
 *///from  ww  w.j a v  a 2  s . co  m
protected void retrieveBubbleAttributes(@NonNull TypedArray typedArray) {
    showBubble = typedArray.getBoolean(R.styleable.FastScroll_re_show_bubble, true);
    bubbleAlignment = BubbleAlignment.get(typedArray.getInt(R.styleable.FastScroll_re_bubble_alignment, 3));

    int textColor = getColor(R.color.recyclerext_fast_scroll_bubble_text_color_default);
    textColor = typedArray.getColor(R.styleable.FastScroll_re_bubble_text_color, textColor);

    int textSize = getResources()
            .getDimensionPixelSize(R.dimen.recyclerext_fast_scroll_bubble_text_size_default);
    textSize = typedArray.getDimensionPixelSize(R.styleable.FastScroll_re_bubble_text_size, textSize);

    Drawable backgroundDrawable = getDrawable(typedArray, R.styleable.FastScroll_re_bubble_background);
    int backgroundColor = getColor(R.color.recyclerext_fast_scroll_bubble_color_default);
    backgroundColor = typedArray.getColor(R.styleable.FastScroll_re_bubble_color, backgroundColor);

    if (backgroundDrawable == null) {
        backgroundDrawable = tint(getDrawable(R.drawable.recyclerext_fast_scroll_bubble), backgroundColor);
    }

    bubble.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
    bubble.setTextColor(textColor);
    bubble.setBackground(backgroundDrawable);
}

From source file:net.ibaixin.chat.view.PagerSlidingTabStrip.java

private void updateTabStyles() {

    for (int i = 0; i < mTabLayout.getChildCount(); i++) {
        View child = mTabLayout.getChildAt(i);
        if (tabBackgroundResId != 0) {
            child.setBackgroundResource(tabBackgroundResId);
        }/*from  w w w .j a  v a 2 s. co  m*/
        final boolean isSelected = (i == selectedPosition);
        child.setSelected(isSelected);
        if (child instanceof TextView) {

            TextView tab = (TextView) child;
            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);
            }
        }
    }

}

From source file:com.github.shareme.gwsmaterialuikit.library.material.widget.EditText.java

@Override
protected void applyStyle(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    super.applyStyle(context, attrs, defStyleAttr, defStyleRes);

    CharSequence text = mInputView == null ? null : mInputView.getText();
    removeAllViews();//from   ww w .  j  a v a2 s  . c o m

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.EditText, defStyleAttr, defStyleRes);

    int labelPadding = -1;
    int labelTextSize = -1;
    ColorStateList labelTextColor = null;
    int supportPadding = -1;
    int supportTextSize = -1;
    ColorStateList supportColors = null;
    ColorStateList supportErrorColors = null;
    String supportHelper = null;
    String supportError = null;
    ColorStateList dividerColors = null;
    ColorStateList dividerErrorColors = null;
    int dividerHeight = -1;
    int dividerPadding = -1;
    int dividerAnimDuration = -1;

    mAutoCompleteMode = a.getInteger(R.styleable.EditText_et_autoCompleteMode, mAutoCompleteMode);
    if (needCreateInputView(mAutoCompleteMode)) {
        switch (mAutoCompleteMode) {
        case AUTOCOMPLETE_MODE_SINGLE:
            mInputView = new InternalAutoCompleteTextView(context, attrs, defStyleAttr);
            break;
        case AUTOCOMPLETE_MODE_MULTI:
            mInputView = new InternalMultiAutoCompleteTextView(context, attrs, defStyleAttr);
            break;
        default:
            mInputView = new InternalEditText(context, attrs, defStyleAttr);
            break;
        }
        ViewUtil.applyFont(mInputView, attrs, defStyleAttr, defStyleRes);
        if (text != null)
            mInputView.setText(text);

        mInputView.addTextChangedListener(new InputTextWatcher());

        if (mDivider != null) {
            mDivider.setAnimEnable(false);
            ViewUtil.setBackground(mInputView, mDivider);
            mDivider.setAnimEnable(true);
        }
    } else
        ViewUtil.applyStyle(mInputView, attrs, defStyleAttr, defStyleRes);
    mInputView.setVisibility(View.VISIBLE);
    mInputView.setFocusableInTouchMode(true);

    for (int i = 0, count = a.getIndexCount(); i < count; i++) {
        int attr = a.getIndex(i);

        if (attr == R.styleable.EditText_et_labelEnable)
            mLabelEnable = a.getBoolean(attr, false);
        else if (attr == R.styleable.EditText_et_labelPadding)
            labelPadding = a.getDimensionPixelSize(attr, 0);
        else if (attr == R.styleable.EditText_et_labelTextSize)
            labelTextSize = a.getDimensionPixelSize(attr, 0);
        else if (attr == R.styleable.EditText_et_labelTextColor)
            labelTextColor = a.getColorStateList(attr);
        else if (attr == R.styleable.EditText_et_labelTextAppearance)
            getLabelView().setTextAppearance(context, a.getResourceId(attr, 0));
        else if (attr == R.styleable.EditText_et_labelEllipsize) {
            int labelEllipsize = a.getInteger(attr, 0);
            switch (labelEllipsize) {
            case 1:
                getLabelView().setEllipsize(TruncateAt.START);
                break;
            case 2:
                getLabelView().setEllipsize(TruncateAt.MIDDLE);
                break;
            case 3:
                getLabelView().setEllipsize(TruncateAt.END);
                break;
            case 4:
                getLabelView().setEllipsize(TruncateAt.MARQUEE);
                break;
            default:
                getLabelView().setEllipsize(TruncateAt.END);
                break;
            }
        } else if (attr == R.styleable.EditText_et_labelInAnim)
            mLabelInAnimId = a.getResourceId(attr, 0);
        else if (attr == R.styleable.EditText_et_labelOutAnim)
            mLabelOutAnimId = a.getResourceId(attr, 0);
        else if (attr == R.styleable.EditText_et_supportMode)
            mSupportMode = a.getInteger(attr, 0);
        else if (attr == R.styleable.EditText_et_supportPadding)
            supportPadding = a.getDimensionPixelSize(attr, 0);
        else if (attr == R.styleable.EditText_et_supportTextSize)
            supportTextSize = a.getDimensionPixelSize(attr, 0);
        else if (attr == R.styleable.EditText_et_supportTextColor)
            supportColors = a.getColorStateList(attr);
        else if (attr == R.styleable.EditText_et_supportTextErrorColor)
            supportErrorColors = a.getColorStateList(attr);
        else if (attr == R.styleable.EditText_et_supportTextAppearance)
            getSupportView().setTextAppearance(context, a.getResourceId(attr, 0));
        else if (attr == R.styleable.EditText_et_supportEllipsize) {
            int supportEllipsize = a.getInteger(attr, 0);
            switch (supportEllipsize) {
            case 1:
                getSupportView().setEllipsize(TruncateAt.START);
                break;
            case 2:
                getSupportView().setEllipsize(TruncateAt.MIDDLE);
                break;
            case 3:
                getSupportView().setEllipsize(TruncateAt.END);
                break;
            case 4:
                getSupportView().setEllipsize(TruncateAt.MARQUEE);
                break;
            default:
                getSupportView().setEllipsize(TruncateAt.END);
                break;
            }
        } else if (attr == R.styleable.EditText_et_supportMaxLines)
            getSupportView().setMaxLines(a.getInteger(attr, 0));
        else if (attr == R.styleable.EditText_et_supportLines)
            getSupportView().setLines(a.getInteger(attr, 0));
        else if (attr == R.styleable.EditText_et_supportSingleLine)
            getSupportView().setSingleLine(a.getBoolean(attr, false));
        else if (attr == R.styleable.EditText_et_supportMaxChars)
            mSupportMaxChars = a.getInteger(attr, 0);
        else if (attr == R.styleable.EditText_et_helper)
            supportHelper = a.getString(attr);
        else if (attr == R.styleable.EditText_et_error)
            supportError = a.getString(attr);
        else if (attr == R.styleable.EditText_et_inputId)
            mInputView.setId(a.getResourceId(attr, 0));
        else if (attr == R.styleable.EditText_et_dividerColor)
            dividerColors = a.getColorStateList(attr);
        else if (attr == R.styleable.EditText_et_dividerErrorColor)
            dividerErrorColors = a.getColorStateList(attr);
        else if (attr == R.styleable.EditText_et_dividerHeight)
            dividerHeight = a.getDimensionPixelSize(attr, 0);
        else if (attr == R.styleable.EditText_et_dividerPadding)
            dividerPadding = a.getDimensionPixelSize(attr, 0);
        else if (attr == R.styleable.EditText_et_dividerAnimDuration)
            dividerAnimDuration = a.getInteger(attr, 0);
        else if (attr == R.styleable.EditText_et_dividerCompoundPadding)
            mDividerCompoundPadding = a.getBoolean(attr, true);
    }

    a.recycle();

    if (mInputView.getId() == 0)
        mInputView.setId(ViewUtil.generateViewId());

    if (mDivider == null) {
        mDividerColors = dividerColors;
        mDividerErrorColors = dividerErrorColors;

        if (mDividerColors == null) {
            int[][] states = new int[][] { new int[] { -android.R.attr.state_focused },
                    new int[] { android.R.attr.state_focused, android.R.attr.state_enabled }, };
            int[] colors = new int[] { ThemeUtil.colorControlNormal(context, 0xFF000000),
                    ThemeUtil.colorControlActivated(context, 0xFF000000), };

            mDividerColors = new ColorStateList(states, colors);
        }

        if (mDividerErrorColors == null)
            mDividerErrorColors = ColorStateList.valueOf(ThemeUtil.colorAccent(context, 0xFFFF0000));

        if (dividerHeight < 0)
            dividerHeight = 0;

        if (dividerPadding < 0)
            dividerPadding = 0;

        if (dividerAnimDuration < 0)
            dividerAnimDuration = context.getResources().getInteger(android.R.integer.config_shortAnimTime);

        mDividerPadding = dividerPadding;
        mInputView.setPadding(0, 0, 0, mDividerPadding + dividerHeight);

        mDivider = new DividerDrawable(dividerHeight,
                mDividerCompoundPadding ? mInputView.getTotalPaddingLeft() : 0,
                mDividerCompoundPadding ? mInputView.getTotalPaddingRight() : 0, mDividerColors,
                dividerAnimDuration);
        mDivider.setInEditMode(isInEditMode());
        mDivider.setAnimEnable(false);
        ViewUtil.setBackground(mInputView, mDivider);
        mDivider.setAnimEnable(true);
    } else {
        if (dividerHeight >= 0 || dividerPadding >= 0) {
            if (dividerHeight < 0)
                dividerHeight = mDivider.getDividerHeight();

            if (dividerPadding >= 0)
                mDividerPadding = dividerPadding;

            mInputView.setPadding(0, 0, 0, mDividerPadding + dividerHeight);
            mDivider.setDividerHeight(dividerHeight);
            mDivider.setPadding(mDividerCompoundPadding ? mInputView.getTotalPaddingLeft() : 0,
                    mDividerCompoundPadding ? mInputView.getTotalPaddingRight() : 0);
        }

        if (dividerColors != null)
            mDividerColors = dividerColors;

        if (dividerErrorColors != null)
            mDividerErrorColors = dividerErrorColors;

        mDivider.setColor(getError() == null ? mDividerColors : mDividerErrorColors);

        if (dividerAnimDuration >= 0)
            mDivider.setAnimationDuration(dividerAnimDuration);
    }

    if (labelPadding >= 0)
        getLabelView().setPadding(mDivider.getPaddingLeft(), 0, mDivider.getPaddingRight(), labelPadding);

    if (labelTextSize >= 0)
        getLabelView().setTextSize(TypedValue.COMPLEX_UNIT_PX, labelTextSize);

    if (labelTextColor != null)
        getLabelView().setTextColor(labelTextColor);

    if (mLabelEnable) {
        mLabelVisible = true;
        getLabelView().setText(mInputView.getHint());
        addView(getLabelView(), 0, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT));
        setLabelVisible(!TextUtils.isEmpty(mInputView.getText().toString()), false);
    }

    if (supportTextSize >= 0)
        getSupportView().setTextSize(TypedValue.COMPLEX_UNIT_PX, supportTextSize);

    if (supportColors != null)
        mSupportColors = supportColors;
    else if (mSupportColors == null)
        mSupportColors = context.getResources().getColorStateList(R.color.abc_secondary_text_material_light);

    if (supportErrorColors != null)
        mSupportErrorColors = supportErrorColors;
    else if (mSupportErrorColors == null)
        mSupportErrorColors = ColorStateList.valueOf(ThemeUtil.colorAccent(context, 0xFFFF0000));

    if (supportPadding >= 0)
        getSupportView().setPadding(mDivider.getPaddingLeft(), supportPadding, mDivider.getPaddingRight(), 0);

    if (supportHelper == null && supportError == null)
        getSupportView().setTextColor(getError() == null ? mSupportColors : mSupportErrorColors);
    else if (supportHelper != null)
        setHelper(supportHelper);
    else
        setError(supportError);

    if (mSupportMode != SUPPORT_MODE_NONE) {
        switch (mSupportMode) {
        case SUPPORT_MODE_CHAR_COUNTER:
            getSupportView().setGravity(Gravity.END);
            updateCharCounter(mInputView.getText().length());
            break;
        case SUPPORT_MODE_HELPER:
        case SUPPORT_MODE_HELPER_WITH_ERROR:
            getSupportView().setGravity(GravityCompat.START);
            break;
        }
        addView(getSupportView(), new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT));
    }

    addView(mInputView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));

    requestLayout();
}

From source file:com.bei.test.view.tab.PagerSlidingTabStrip.java

private void unSelect(View tab) {
    if (tab != null) {
        TextView tab_title = (TextView) tab.findViewById(R.id.psts_tab_title);
        if (tab_title != null) {
            tab_title.setSelected(false);
            tab_title.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTabNormalTextSize);
        }/*from  w  w  w . j av  a  2  s. c o  m*/
        if (isCustomTabs)
            ((CustomTabProvider) mPager.getAdapter()).tabUnselected(tab);
    }
}

From source file:org.de.jmg.learn._MainActivity.java

private void resize() {

    RelativeLayout.LayoutParams params;//w  w w  .  ja v  a  2 s.  co m
    Resources resources = context.getResources();
    DisplayMetrics metrics = resources.getDisplayMetrics();
    int height = metrics.heightPixels;
    width = metrics.widthPixels;
    int viewTop = _main.findViewById(Window.ID_ANDROID_CONTENT).getTop();
    height = height - viewTop;
    scale = (double) height / (double) 950;
    double ratio = Math.pow((double) width / (double) height, .5d);
    boolean blnHorizontal = width > height;
    if (scale < .5f) {
        _isSmallDevice = true;
        _main.isSmallDevice = true;
        if (scale < .4f) {
            scale = .4f;
        }
    }
    /*
     * lib.ShowMessage(this, "Meaning3 Bottom: " +_txtMeaning3.getBottom() +
     * "\nbtnRight.Top: " + _btnRight.getTop() + "\nDisplayHeight: " +
     * height);
     */
    if (scale != 1) {
        // lib.ShowToast(_main, "Scaling font by " + scale + " Screenheight = "
        //+ height);

        float tSize = _txtMeaning1.getTextSize();
        if (tSize == 40 || (_vok.getCardMode() && tSize == 25)) {
            _txtMeaning1.setTextSize(TypedValue.COMPLEX_UNIT_PX, (float) (_txtMeaning1.getTextSize() * scale));
        }
        params = (android.widget.RelativeLayout.LayoutParams) _txtMeaning1.getLayoutParams();
        if (params.topMargin == 120) {
            if (!_isSmallDevice) {
                params.topMargin = (int) (params.topMargin * scale);
            } else {
                params.topMargin = (int) (params.topMargin * .1f);
            }
            _txtMeaning1.setLayoutParams(params);
        }

        if (_txtMeaning2.getTextSize() == 40) {
            _txtMeaning2.setTextSize(TypedValue.COMPLEX_UNIT_PX, (float) (_txtMeaning2.getTextSize() * scale));
        }
        params = (android.widget.RelativeLayout.LayoutParams) _txtMeaning2.getLayoutParams();
        if (params.topMargin == 56) {
            params.topMargin = (int) (params.topMargin * scale);
            _txtMeaning2.setLayoutParams(params);
        }

        if (_txtMeaning3.getTextSize() == 40) {
            _txtMeaning3.setTextSize(TypedValue.COMPLEX_UNIT_PX, (float) (_txtMeaning3.getTextSize() * scale));
        }
        params = (android.widget.RelativeLayout.LayoutParams) _txtMeaning3.getLayoutParams();
        if (params.topMargin == 56) {
            params.topMargin = (int) (params.topMargin * scale);
            _txtMeaning3.setLayoutParams(params);
        }

        float size = _txtWord.getTextSize();
        if (size == 60) {
            size *= scale;
            _txtWord.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
        }
        if (_txtKom.getTextSize() == 35) {
            _txtKom.setTextSize(TypedValue.COMPLEX_UNIT_PX, (float) (_txtKom.getTextSize() * scale));
        }
        if (_txtedWord.getTextSize() == 60) {
            _txtedWord.setTextSize(TypedValue.COMPLEX_UNIT_PX, (float) (_txtedWord.getTextSize() * scale));
        }
        if (_txtedKom.getTextSize() == 35) {
            _txtedKom.setTextSize(TypedValue.COMPLEX_UNIT_PX, (float) (_txtedKom.getTextSize() * scale));
        }
        if (_vok != null && _vok.getCardMode()) {
            SetViewsToCardmode();
        } else {
            SetViewsToVokMode();
        }

        /*
         * _txtMeaning1.setOnFocusChangeListener(new
         * View.OnFocusChangeListener() {
         *
         * @Override public void onFocusChange(View v, boolean hasFocus) {
         *  if (_firstFocus && hasFocus) {
         * hideKeyboard(); _firstFocus = false; } } });
         */
    }
    if (scale != 1) {
        int widthButtons = _btnEdit.getRight() - _btnSkip.getLeft();
        int allButtonsWidth = 520; /*_btnEdit.getWidth()
                                   +_btnRight.getWidth()
                                   +_btnView.getWidth()
                                   +_btnWrong.getWidth()
                                   +_btnEdit.getWidth();
                                   */
        if (widthButtons < allButtonsWidth) {
            widthButtons = allButtonsWidth;
            blnWrongWidth = true;
        }
        ScaleWidth = (width - 50) / (double) widthButtons;
        if (ScaleWidth < .7) {
            _btnEdit.setVisibility(View.GONE);
            _btnSkip.setVisibility(View.GONE);
            widthButtons = _btnWrong.getRight() - _btnRight.getLeft();
            if (widthButtons < 330) {
                widthButtons = 330;
                blnWrongWidth = true;
            }
            ScaleWidth = ((double) (_txtMeaning1.getRight() - _txtMeaning1.getLeft())) / (double) widthButtons;
            if (ScaleWidth < .4d)
                ScaleWidth = .4d;
            ScaleTextButtons = ((scale > ScaleWidth) ? scale : ScaleWidth);
        } else {
            ScaleTextButtons = ((scale < ScaleWidth) ? scale : ScaleWidth);

        }

        RelativeLayout layoutButtons = (RelativeLayout) findViewById(R.id.layoutButtonsInner);
        params = (android.widget.RelativeLayout.LayoutParams) layoutButtons.getLayoutParams();
        if (!blnWrongWidth) {
            params.bottomMargin = (int) (params.bottomMargin * scale);
        } else {
            params.bottomMargin = (int) (0 * ScaleWidth);
        }
        layoutButtons.setLayoutParams(params);

        params = (android.widget.RelativeLayout.LayoutParams) _btnRight.getLayoutParams();
        if (!blnWrongWidth) {
            params.height = (int) (params.height * scale);
            params.bottomMargin = (int) (params.bottomMargin * scale);
        } else {
            params.height = (int) (60 * ScaleWidth);
            params.bottomMargin = (int) (0 * ScaleWidth);
            _btnRight.setPadding((int) (_btnRight.getPaddingLeft() * ScaleWidth),
                    (int) (_btnRight.getPaddingTop() * ScaleWidth),
                    (int) (_btnRight.getPaddingRight() * ScaleWidth),
                    (int) (_btnRight.getPaddingBottom() * ScaleWidth));
        }
        params.width = (int) (params.width * ScaleWidth);
        double ScaleTextButtonsOrig = ScaleTextButtons;

        if (blnHorizontal) {
            params.height *= ratio;
            ScaleTextButtons *= ratio;
        }
        _btnRight.setLayoutParams(params);

        params = (android.widget.RelativeLayout.LayoutParams) _btnWrong.getLayoutParams();
        if (!blnWrongWidth) {
            params.height = (int) (params.height * scale);
            params.bottomMargin = (int) (params.bottomMargin * scale);
        } else {
            params.height = (int) (60 * ScaleWidth);
            params.bottomMargin = (int) (0 * ScaleWidth);
            _btnWrong.setPadding((int) (_btnWrong.getPaddingLeft() * ScaleWidth),
                    (int) (_btnWrong.getPaddingTop() * ScaleWidth),
                    (int) (_btnWrong.getPaddingRight() * ScaleWidth),
                    (int) (_btnWrong.getPaddingBottom() * ScaleWidth));
        }
        params.width = (int) (params.width * ScaleWidth);
        if (blnHorizontal)
            params.height *= ratio;
        _btnWrong.setLayoutParams(params);

        params = (android.widget.RelativeLayout.LayoutParams) _btnSkip.getLayoutParams();
        if (!blnWrongWidth) {
            params.height = (int) (params.height * scale);
            params.bottomMargin = (int) (params.bottomMargin * scale);
        } else {
            params.height = (int) (60 * ScaleWidth);
            params.bottomMargin = (int) (0 * ScaleWidth);
        }
        params.width = (int) (params.width * ScaleWidth);
        if (blnHorizontal)
            params.height *= ratio;
        _btnSkip.setLayoutParams(params);

        params = (android.widget.RelativeLayout.LayoutParams) _btnView.getLayoutParams();
        if (!blnWrongWidth) {
            params.height = (int) (params.height * scale);
            params.bottomMargin = (int) (params.bottomMargin * scale);
        } else {
            params.height = (int) (60 * ScaleWidth);
            params.bottomMargin = (int) (0 * ScaleWidth);
            _btnView.setPadding((int) (_btnView.getPaddingLeft() * ScaleWidth),
                    (int) (_btnView.getPaddingTop() * ScaleWidth),
                    (int) (_btnView.getPaddingRight() * ScaleWidth),
                    (int) (_btnView.getPaddingBottom() * ScaleWidth));
        }
        params.width = (int) (params.width * ScaleWidth);
        if (blnHorizontal)
            params.height *= ratio;
        _btnView.setLayoutParams(params);

        params = (android.widget.RelativeLayout.LayoutParams) _btnEdit.getLayoutParams();
        if (!blnWrongWidth) {
            params.height = (int) (params.height * scale);
            params.bottomMargin = (int) (params.bottomMargin * scale);
        } else {
            params.height = (int) (60 * ScaleWidth);
            params.bottomMargin = (int) (0 * ScaleWidth);
        }
        params.width = (int) (params.width * ScaleWidth);
        if (blnHorizontal)
            params.height *= ratio;
        _btnEdit.setLayoutParams(params);

        params = (android.widget.RelativeLayout.LayoutParams) _txtStatus.getLayoutParams();
        if (!blnWrongWidth) {
            params.topMargin = (int) (params.topMargin * scale);
        } else {
            params.topMargin = (int) (0 * ScaleWidth);
        }
        _txtStatus.setLayoutParams(params);

        _btnRight.setTextSize(TypedValue.COMPLEX_UNIT_PX, (float) (_btnRight.getTextSize() * ScaleTextButtons));
        _btnSkip.setTextSize(TypedValue.COMPLEX_UNIT_PX, (float) (_btnSkip.getTextSize() * ScaleTextButtons));
        _btnView.setTextSize(TypedValue.COMPLEX_UNIT_PX, (float) (_btnView.getTextSize() * ScaleTextButtons));
        _btnWrong.setTextSize(TypedValue.COMPLEX_UNIT_PX, (float) (_btnWrong.getTextSize() * ScaleTextButtons));
        _btnEdit.setTextSize(TypedValue.COMPLEX_UNIT_PX, (float) (_btnEdit.getTextSize() * ScaleTextButtons));
        _txtStatus.setTextSize(TypedValue.COMPLEX_UNIT_PX,
                (float) (_txtStatus.getTextSize() * ScaleTextButtonsOrig));

        //_main.ActionBarOriginalTextSize = 0;
        resizeActionbar(0);
        Runnable r = new resetLayoutTask(null);
        rFlashs.add(r);
        handler.post(r);

    }
}

From source file:com.bei.test.view.tab.PagerSlidingTabStrip.java

private void select(View tab) {
    if (tab != null) {
        TextView tab_title = (TextView) tab.findViewById(R.id.psts_tab_title);
        if (tab_title != null) {
            tab_title.setSelected(true);
            tab_title.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTabSelectTextSize);
        }/*from www. j  a v a 2 s  .  co  m*/
        if (isCustomTabs)
            ((CustomTabProvider) mPager.getAdapter()).tabSelected(tab);
    }
}

From source file:com.taobao.weex.extend.module.actionsheet.WXActionSheet.java

private TextView createItemBase() {
    TextView textView = new TextView(getActivity());
    textView.setBackgroundColor(Color.WHITE);
    textView.setGravity(Gravity.CENTER);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, dp2px(18));
    return textView;
}