當前位置: 首頁>>代碼示例>>Java>>正文


Java TextView.setAllCaps方法代碼示例

本文整理匯總了Java中android.widget.TextView.setAllCaps方法的典型用法代碼示例。如果您正苦於以下問題:Java TextView.setAllCaps方法的具體用法?Java TextView.setAllCaps怎麽用?Java TextView.setAllCaps使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.TextView的用法示例。


在下文中一共展示了TextView.setAllCaps方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: updateTextTab

import android.widget.TextView; //導入方法依賴的package包/類
private void updateTextTab(int i, View v) {
    TextView tab = (TextView) v;
    tab.setTextSize(0, (float) this.tabTextSize);
    tab.setTypeface(this.tabTypeface, this.tabTypefaceStyle);
    if (i == this.pager.getCurrentItem()) {
        tab.setTextColor(getIndicatorColor());
    } else {
        tab.setTextColor(this.tabTextColor);
    }
    if (!this.textAllCaps) {
        return;
    }
    if (VERSION.SDK_INT >= 14) {
        tab.setAllCaps(true);
    } else {
        tab.setText(tab.getText().toString().toUpperCase(this.locale));
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:19,代碼來源:PagerSlidingTabStrip.java

示例2: createDefaultTabView

import android.widget.TextView; //導入方法依賴的package包/類
/**
 * Create a default view to be used for tabs. This is called if a custom tab view is not set via
 * {@link #setCustomTabView(int, int)}.
 */
protected TextView createDefaultTabView(Context context) {
    TextView textView = new TextView(context);
    textView.setGravity(Gravity.CENTER);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP);
    textView.setTypeface(Typeface.DEFAULT_BOLD);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        // If we're running on Honeycomb or newer, then we can use the Theme's
        // selectableItemBackground to ensure that the View has a pressed state
        TypedValue outValue = new TypedValue();
        getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground,
                outValue, true);
        textView.setBackgroundResource(outValue.resourceId);
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        // If we're running on ICS or newer, enable all-caps to match the Action Bar tab style
        textView.setAllCaps(true);
    }

    int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
    textView.setPadding(padding, padding, padding, padding);

    return textView;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:30,代碼來源:SlidingTabLayout.java

示例3: createDefaultTabView

import android.widget.TextView; //導入方法依賴的package包/類
/**
 * Create a default view to be used for tabs. This is called if a custom tab view is not set via
 * {@link #setCustomTabView(int, int)}.
 */
protected TextView createDefaultTabView(Context context) {
    TextView textView = new TextView(context);
    textView.setGravity(Gravity.CENTER);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP);
    textView.setTypeface(Typeface.DEFAULT_BOLD);
    textView.setLayoutParams(new LinearLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));

    TypedValue outValue = new TypedValue();
    getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground,
            outValue, true);
    textView.setBackgroundResource(outValue.resourceId);
    textView.setAllCaps(true);

    int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
    textView.setPadding(padding, padding, padding, padding);

    return textView;
}
 
開發者ID:dreaminglion,項目名稱:iosched-reader,代碼行數:24,代碼來源:SlidingTabLayout.java

示例4: updateTabStyles

import android.widget.TextView; //導入方法依賴的package包/類
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) {
                    tab.setAllCaps(true);
                }
            }
        }

    }
 
開發者ID:89luca89,項目名稱:ThunderMusic,代碼行數:26,代碼來源:PagerTabStrip.java

示例5: createDefaultTabView

import android.widget.TextView; //導入方法依賴的package包/類
/**
 * Create a default view to be used for tabs. This is called if a custom f_per_easy.xmll view is not set via
 * {@link #setCustomTabView(int, int)}.
 */
protected TextView createDefaultTabView(Context context) {
    TextView textView = new TextView(context);
    textView.setGravity(Gravity.CENTER);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP);
    textView.setTypeface(Typeface.DEFAULT_BOLD);
    textView.setLayoutParams(new LinearLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));

    TypedValue outValue = new TypedValue();
    getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground,
            outValue, true);
    textView.setBackgroundResource(outValue.resourceId);
    textView.setAllCaps(true);

    int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
    textView.setPadding(padding, padding, padding, padding);

    return textView;
}
 
開發者ID:sarveshchavan7,項目名稱:Trivia-Knowledge,代碼行數:24,代碼來源:SlidingTabLayout.java

示例6: updateTabStyles

import android.widget.TextView; //導入方法依賴的package包/類
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));
					}
				}
			}
		}

	}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:29,代碼來源:PagerSlidingTabStrip.java

示例7: updateTabStyles

import android.widget.TextView; //導入方法依賴的package包/類
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));
                    }
                }
                if (i == selectedPosition) {
                    tab.setTextColor(selectedTabTextColor);
                }
            }
        }

    }
 
開發者ID:newDeepLearing,項目名稱:decoy,代碼行數:32,代碼來源:PagerSlidingTabStrip.java

示例8: updateTabStyles

import android.widget.TextView; //導入方法依賴的package包/類
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));
                    }
                }
            }
        }

    }
 
開發者ID:Aiushtha,項目名稱:Go-RxJava,代碼行數:29,代碼來源:PagerSlidingTabStrip.java

示例9: updateTabStyles

import android.widget.TextView; //導入方法依賴的package包/類
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_SP, tabTextSize);
                tab.setTypeface(tabTypeface, tabTypefaceStyle);

                // @lee.sz {
                if (i == currentPosition) {
                    tab.setTextColor(selectedTabTextColor);
                } else {
                    tab.setTextColor(tabTextColor);
                }
                // @lee.sz }

                // 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));
                    }
                }
            }
        }

    }
 
開發者ID:teisun,項目名稱:SunmiUI,代碼行數:36,代碼來源:PagerSlidingTabStrip.java

示例10: updateTabStyles

import android.widget.TextView; //導入方法依賴的package包/類
private void updateTabStyles() {

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

			View v = tabsContainer.getChildAt(i);
			if (tabBackgroundResId != -1) {
				//v.setBackgroundResource(tabBackgroundResId);
				v.setBackgroundDrawable(ContextCompat.getDrawable(getContext(),tabBackgroundResId));
			}

			if (v instanceof TextView) {

				TextView tab = (TextView) v;
				tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
				tab.setTypeface(tabTypeface, tabTypefaceStyle);
				if (pager.getCurrentItem() == i) {
					pageSelected=i;
					tab.setTextColor(tabSelectTextColor);
				} else {
					tab.setTextColor(tabUnSelectTextColor);
				}

				// 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));
					}
				}
			}
		}

	}
 
開發者ID:z-chu,項目名稱:FriendBook,代碼行數:38,代碼來源:PagerSlidingTabStrip.java

示例11: init

import android.widget.TextView; //導入方法依賴的package包/類
private void init(Context context, AttributeSet attrs){
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ProgressButton);

    int layout;
    int buttonColor;
    String buttonTitle;
    boolean allCaps;

    try {
        layout = a.getResourceId(R.styleable.ProgressButton_button_layout, R.layout.content_progress_button);
        buttonColor = a.getColor(R.styleable.ProgressButton_button_color, Color.BLUE);
        buttonTitle = a.getString(R.styleable.ProgressButton_button_text);
        allCaps = a.getBoolean(R.styleable.ProgressButton_button_all_caps, true);
    } finally {
        a.recycle();
    }

    View view = LayoutInflater.from(context).inflate(layout, this, false);
    view.setBackgroundColor(buttonColor);

    mTitleTextView = (TextView) view.findViewById(R.id.progress_button_title_text);

    mTitleTextView.setText(buttonTitle);
    mTitleTextView.setAllCaps(allCaps);

    mProgressIcon = (ImageView) view.findViewById(R.id.progress_button_progress_icon);
    mTitleRoot = view.findViewById(R.id.progress_button_title_root);

    addView(view);

    resolveViews();
}
 
開發者ID:PhoenixDevTeam,項目名稱:Phoenix-for-VK,代碼行數:33,代碼來源:ProgressButton.java

示例12: createDefaultTabView

import android.widget.TextView; //導入方法依賴的package包/類
/**
 * Create a default view to be used for tabs. This is called if a custom tab view is not set via
 * {@link #setCustomTabView(int, int)}.
 */
protected TextView createDefaultTabView(CharSequence title) {
  TextView textView = new TextView(getContext());
  textView.setGravity(Gravity.CENTER);
  textView.setText(title);
  textView.setTextColor(tabViewTextColors);
  textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabViewTextSize);
  textView.setTypeface(Typeface.DEFAULT_BOLD);
  textView.setLayoutParams(new LinearLayout.LayoutParams(
      LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT));

  if (tabViewBackgroundResId != NO_ID) {
    textView.setBackgroundResource(tabViewBackgroundResId);
  } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
    // If we're running on Honeycomb or newer, then we can use the Theme's
    // selectableItemBackground to ensure that the View has a pressed state
    TypedValue outValue = new TypedValue();
    getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground,
        outValue, true);
    textView.setBackgroundResource(outValue.resourceId);
  }

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
    // If we're running on ICS or newer, enable all-caps to match the Action Bar tab style
    textView.setAllCaps(tabViewTextAllCaps);
  }

  textView.setPadding(
      tabViewTextHorizontalPadding, 0,
      tabViewTextHorizontalPadding, 0);

  if (tabViewTextMinWidth > 0) {
    textView.setMinWidth(tabViewTextMinWidth);
  }

  return textView;
}
 
開發者ID:devzwy,項目名稱:KUtils,代碼行數:41,代碼來源:SmartTabLayout.java

示例13: createDefaultTabView

import android.widget.TextView; //導入方法依賴的package包/類
protected TextView createDefaultTabView(Context context) {
    TextView textView = new TextView(context);
    textView.setGravity(17);
    textView.setTextColor(context.getResources().getColor(R.color.c4));
    textView.setTextSize(2, 14.0f);
    textView.setTypeface(Typeface.DEFAULT);
    textView.setLayoutParams(new LayoutParams(-2, -2));
    TypedValue outValue = new TypedValue();
    getContext().getTheme().resolveAttribute(16843534, outValue, true);
    textView.setBackgroundResource(outValue.resourceId);
    textView.setAllCaps(true);
    int padding = (int) (12.0f * getResources().getDisplayMetrics().density);
    textView.setPadding(padding, padding, padding, padding);
    return textView;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:16,代碼來源:SlidingTabLayout.java

示例14: onBindView

import android.widget.TextView; //導入方法依賴的package包/類
@Override
protected void onBindView(View view) {
    super.onBindView(view);
    TextView titleView = (TextView) view.findViewById(android.R.id.title);
    titleView.setAllCaps(true);
    titleView.setTextColor(mPrefAccentColor);
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:8,代碼來源:AddExceptionPreference.java

示例15: updateTabStyles

import android.widget.TextView; //導入方法依賴的package包/類
private void updateTabStyles() {
    for (int i = 0; i < tabCount; i++) {
        FrameLayout frameLayout = (FrameLayout) tabsContainer.getChildAt(i);
        frameLayout.setBackgroundResource(tabBackgroundResId);

        for (int j = 0; j < frameLayout.getChildCount(); j++) {
            View v = frameLayout.getChildAt(j);
            if (v instanceof TextView) {
                TextView tab = (TextView) v;
                tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
                tab.setTypeface(tabTypeface, tabTypefaceStyle);
                tab.setPadding(tabPadding, 0, tabPadding, 0);
                if (j == 0) {
                    tab.setTextColor(tabTextColor);
                } else {
                    tab.setTextColor(selectedTabTextColor);
                }
                ViewHelper.setAlpha(tabViews.get(i).get("normal"), 1);
                ViewHelper.setAlpha(tabViews.get(i).get("selected"), 0);

                //set normal  Scale
                ViewHelper.setPivotX(frameLayout, frameLayout.getMeasuredWidth() * 0.5f);
                ViewHelper.setPivotY(frameLayout, frameLayout.getMeasuredHeight() * 0.5f);
                ViewHelper.setScaleX(frameLayout, 1f);
                ViewHelper.setScaleY(frameLayout, 1f);

                // 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) {
                    ViewHelper.setAlpha(tabViews.get(i).get("normal"), 0);
                    ViewHelper.setAlpha(tabViews.get(i).get("selected"), 1);

                    //set select  Scale
                    ViewHelper.setPivotX(frameLayout, frameLayout.getMeasuredWidth() * 0.5f);
                    ViewHelper.setPivotY(frameLayout, frameLayout.getMeasuredHeight() * 0.5f);
                    ViewHelper.setScaleX(frameLayout, 1 + zoomMax);
                    ViewHelper.setScaleY(frameLayout, 1 + zoomMax);
                }
            }
        }
    }
}
 
開發者ID:SavorGit,項目名稱:Hotspot-master-devp,代碼行數:50,代碼來源:PagerSlidingTabStrip.java


注:本文中的android.widget.TextView.setAllCaps方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。