List of usage examples for android.util TypedValue COMPLEX_UNIT_PX
int COMPLEX_UNIT_PX
To view the source code for android.util TypedValue COMPLEX_UNIT_PX.
Click Source Link
From source file:mika.com.android.ac.ui.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 . j av a 2 s.c om*/ } if (i == selectedPosition) { tab.setTextColor(selectedTabTextColor); tab.setBackgroundColor(selectedTabColor); } } } }
From source file:brostore.maquillage.custom.PagerSlidingTabStrip.java
private void setTextViewStyle(View v) { TextView tab = (TextView) v;// ww w . j a v a 2 s . c o m tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); // TODO //tab.setTextColor(tabTextColor); ColorStateList colorStateList = new ColorStateList(new int[][] { new int[] { android.R.attr.state_pressed }, //1 new int[] { android.R.attr.state_selected }, //2 new int[] {} //3 }, new int[] { Color.WHITE, //1 Color.WHITE, //2 getResources().getColor(R.color.tab_text_color_unselected) //3 }); tab.setTextColor(colorStateList); tab.setTextScaleX(tabTextScaleX); // 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.cc.custom.uikit.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); if (tabSelectedBackgroundResId > 0) { v.setBackgroundResource(tabBackgroundResId); }//from w w w . j a v a 2 s . co m 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 source file:com.yktx.check.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); 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 av a2 s . co m*/ } // System.out.println("i"+i+"selectedPosition"+selectedPosition); if (i == selectedPosition) { tab.setTextColor(selectedTabTextColor); tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, selectTabTextSize); } } else if (v instanceof View) {//? TextView tab = text2; tab.setTextColor(tabTextColor); if (i == selectedPosition) { tab.setTextColor(selectedTabTextColor); tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, selectTabTextSize); } if (isAlertVisibility) { image2.setVisibility(View.VISIBLE); } else { image2.setVisibility(View.INVISIBLE); } } } }
From source file:com.xujun.funapp.widget.TabPagerIndicator.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 && pager.getCurrentItem() == 0) { tab.setTextColor(tabSelectTextColor); } else { tab.setTextColor(tabTextColor); }//from w w w . ja v 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:cn.hollo.www.custom_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.setSelected(currentPosition == i); // 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 a v a 2 s . c om } } } }
From source file:com.mugu.mp3prayer.utils.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 (tabTextColorStateListId != -1) { ColorStateList cs = getResources().getColorStateList(tabTextColorStateListId); tab.setTextColor(cs);/*from www. ja va2 s .c om*/ } else { 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)); } } } } /* zhaobinbin */ if (tabTextColorOnSelected != -1) { updateTextColorOnSelected(currentPosition); } /* zhaobinbin */ }
From source file:org.chromium.chrome.browser.omnibox.SuggestionView.java
/** * Sets the contents and state of the view for the given suggestion. * * @param suggestionItem The omnibox suggestion item this view represents. * @param suggestionDelegate The suggestion delegate. * @param position Position of the suggestion in the dropdown list. * @param useDarkColors Whether dark colors should be used for fonts and icons. *///from w ww . j a v a2 s . c o m public void init(OmniboxResultItem suggestionItem, OmniboxSuggestionDelegate suggestionDelegate, int position, boolean useDarkColors) { ViewCompat.setLayoutDirection(this, ViewCompat.getLayoutDirection(mUrlBar)); // Update the position unconditionally. mPosition = position; jumpDrawablesToCurrentState(); boolean colorsChanged = mUseDarkColors == null || mUseDarkColors != useDarkColors; if (suggestionItem.equals(mSuggestionItem) && !colorsChanged) return; mUseDarkColors = useDarkColors; if (colorsChanged) { mContentsView.mTextLine1.setTextColor(getStandardFontColor()); setRefineIcon(true); } mSuggestionItem = suggestionItem; mSuggestion = suggestionItem.getSuggestion(); mSuggestionDelegate = suggestionDelegate; // Reset old computations. mContentsView.resetTextWidths(); mContentsView.mAnswerImage.setVisibility(GONE); mContentsView.mAnswerImage.getLayoutParams().height = 0; mContentsView.mAnswerImage.getLayoutParams().width = 0; mContentsView.mAnswerImage.setImageDrawable(null); mContentsView.mAnswerImageMaxSize = 0; mContentsView.mTextLine1.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.omnibox_suggestion_first_line_text_size)); mContentsView.mTextLine2.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.omnibox_suggestion_second_line_text_size)); // Suggestions with attached answers are rendered with rich results regardless of which // suggestion type they are. if (mSuggestion.hasAnswer()) { setAnswer(mSuggestion.getAnswer()); mContentsView.setSuggestionIcon(SUGGESTION_ICON_MAGNIFIER, colorsChanged); mContentsView.mTextLine2.setVisibility(VISIBLE); setRefinable(true); return; } else { mNumAnswerLines = 1; mContentsView.mTextLine2.setEllipsize(null); mContentsView.mTextLine2.setSingleLine(); } boolean sameAsTyped = suggestionItem.getMatchedQuery().equalsIgnoreCase(mSuggestion.getDisplayText()); int suggestionType = mSuggestion.getType(); if (mSuggestion.isUrlSuggestion()) { if (mSuggestion.isStarred()) { mContentsView.setSuggestionIcon(SUGGESTION_ICON_BOOKMARK, colorsChanged); } else if (suggestionType == OmniboxSuggestionType.HISTORY_URL) { mContentsView.setSuggestionIcon(SUGGESTION_ICON_HISTORY, colorsChanged); } else { mContentsView.setSuggestionIcon(SUGGESTION_ICON_GLOBE, colorsChanged); } boolean urlShown = !TextUtils.isEmpty(mSuggestion.getUrl()); boolean urlHighlighted = false; if (urlShown) { urlHighlighted = setUrlText(suggestionItem); } else { mContentsView.mTextLine2.setVisibility(INVISIBLE); } setSuggestedQuery(suggestionItem, true, urlShown, urlHighlighted); setRefinable(!sameAsTyped); } else { @SuggestionIcon int suggestionIcon = SUGGESTION_ICON_MAGNIFIER; if (suggestionType == OmniboxSuggestionType.VOICE_SUGGEST) { suggestionIcon = SUGGESTION_ICON_VOICE; } else if ((suggestionType == OmniboxSuggestionType.SEARCH_SUGGEST_PERSONALIZED) || (suggestionType == OmniboxSuggestionType.SEARCH_HISTORY)) { // Show history icon for suggestions based on user queries. suggestionIcon = SUGGESTION_ICON_HISTORY; } mContentsView.setSuggestionIcon(suggestionIcon, colorsChanged); setRefinable(!sameAsTyped); setSuggestedQuery(suggestionItem, false, false, false); if ((suggestionType == OmniboxSuggestionType.SEARCH_SUGGEST_ENTITY) || (suggestionType == OmniboxSuggestionType.SEARCH_SUGGEST_PROFILE)) { showDescriptionLine(SpannableString.valueOf(mSuggestion.getDescription()), false); } else { mContentsView.mTextLine2.setVisibility(INVISIBLE); } } }
From source file:com.easemob.easeui.widget.viewpagerindicator.PagerSlidingTabStrip.java
public void initTabStyles() { 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 2s .c om } if (i == selectedPosition) { tab.setTextColor(selectedTabTextColor); if (oldTab != null) { oldTab.setSelected(false); ((TextView) oldTab).setTextColor(tabTextColor); } oldTab = tab; tab.setSelected(true); } } } }
From source file:com.cplatform.xhxw.ui.ui.base.view.PagerSlidingTabStrip.java
public void setTabTextColor(int position) { if (tabsContainer != null) { int size = tabsContainer.getChildCount(); View v = null;//from w ww .j av a2s .c o m if (position < size && cur_page < size) { v = tabsContainer.getChildAt(cur_page); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTextColor(tabTextColor); } v = tabsContainer.getChildAt(position); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, selectTabTextSize); tab.setTextColor(selectTabTextColor); } cur_page = position; } } }