本文整理汇总了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));
}
}
示例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;
}
示例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;
}
示例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);
}
}
}
}
示例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;
}
示例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));
}
}
}
}
}
示例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);
}
}
}
}
示例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));
}
}
}
}
}
示例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));
}
}
}
}
}
示例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));
}
}
}
}
}
示例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();
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
}
}
}
}