本文整理了Java中android.widget.TextView.setTextAppearance()
方法的一些代码示例,展示了TextView.setTextAppearance()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextView.setTextAppearance()
方法的具体详情如下:
包路径:android.widget.TextView
类名称:TextView
方法名:setTextAppearance
暂无
代码示例来源:origin: stackoverflow.com
TextView textViewTitle = (TextView) findViewById(R.id.text_view_title);
textViewTitle.setTextAppearance(this, R.style.RedHUGEText);
代码示例来源:origin: googlemaps/android-maps-utils
/**
* Sets the text color, size, style, hint color, and highlight color from the specified
* <code>TextAppearance</code> resource.
*
* @param resid the identifier of the resource.
*/
public void setTextAppearance(Context context, int resid) {
if (mTextView != null) {
mTextView.setTextAppearance(context, resid);
}
}
代码示例来源:origin: Ramotion/expanding-collection-android
private TextView createViewForTextSwitcher(Context context) {
TextView textView = new TextView(context);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
textView.setTextAppearance(R.style.positionIndicatorCurrent);
} else {
textView.setTextAppearance(context, R.style.positionIndicatorCurrent);
}
textView.setLayoutParams(new TextSwitcher.LayoutParams(TextSwitcher.LayoutParams.WRAP_CONTENT, TextSwitcher.LayoutParams.WRAP_CONTENT));
return textView;
}
代码示例来源:origin: stackoverflow.com
TextView title = new TextView(context);
title.setTextAppearance(context, android.R.attr.textAppearanceLarge);
代码示例来源:origin: Ramotion/cardslider-android
@SuppressWarnings("deprecation")
@Override
public View makeView() {
final TextView textView = new TextView(MainActivity.this);
if (center) {
textView.setGravity(Gravity.CENTER);
}
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
textView.setTextAppearance(MainActivity.this, styleId);
} else {
textView.setTextAppearance(styleId);
}
return textView;
}
代码示例来源:origin: roughike/BottomBar
/**
* A convenience method for setting text appearance.
*
* @param textView a TextView which textAppearance to modify.
* @param resId a style resource for the text appearance.
*/
@SuppressWarnings("deprecation")
protected static void setTextAppearance(@NonNull TextView textView, @StyleRes int resId) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
textView.setTextAppearance(resId);
} else {
textView.setTextAppearance(textView.getContext(), resId);
}
}
代码示例来源:origin: roughike/BottomBar
@SuppressWarnings("deprecation")
private void updateCustomTextAppearance() {
if (titleView == null || titleTextAppearanceResId == 0) {
return;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
titleView.setTextAppearance(titleTextAppearanceResId);
} else {
titleView.setTextAppearance(getContext(), titleTextAppearanceResId);
}
titleView.setTag(R.id.bb_bottom_bar_appearance_id, titleTextAppearanceResId);
}
代码示例来源:origin: hidroh/materialistic
public static void setTextAppearance(TextView textView, @StyleRes int textAppearance) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
textView.setTextAppearance(textAppearance);
} else {
//noinspection deprecation
textView.setTextAppearance(textView.getContext(), textAppearance);
}
}
代码示例来源:origin: aa112901/remusic
@TargetApi(Build.VERSION_CODES.M)
@Override
public void setTextAppearance(int resId) {
super.setTextAppearance(resId);
if (mTextHelper != null) {
mTextHelper.setTextAppearanceForTextColor(resId);
}
}
代码示例来源:origin: aa112901/remusic
@Override
public void setTextAppearance(Context context, int resId) {
super.setTextAppearance(context, resId);
if (mTextHelper != null) {
mTextHelper.setTextAppearanceForTextColor(resId);
}
}
代码示例来源:origin: prolificinteractive/material-calendarview
/**
* @param resourceId The text appearance resource id.
*/
public void setHeaderTextAppearance(int resourceId) {
title.setTextAppearance(getContext(), resourceId);
}
代码示例来源:origin: ZieIony/Carbon
@Override
public void setTextAppearance(@NonNull Context context, int resid) {
super.setTextAppearance(context, resid);
setTextAppearanceInternal(resid, false);
}
代码示例来源:origin: novoda/android-demos
private void setTextStyle(TextView view, int style) {
if (style != 0) {
view.setTextAppearance(getContext(), style);
}
}
代码示例来源:origin: qiujuer/Genius-Android
public void setTextAppearance(int resId) {
mNumber.setTextAppearance(getContext(), resId);
}
代码示例来源:origin: robolectric/robolectric
@Implementation
protected void setTextAppearance(Context context, int resid) {
textAppearanceId = resid;
directlyOn(realTextView, TextView.class).setTextAppearance(context, resid);
}
代码示例来源:origin: ZieIony/Carbon
public void setTextAppearance(int resid) {
super.setTextAppearance(getContext(), resid);
setTextAppearanceInternal(resid, false);
}
代码示例来源:origin: Ramotion/expanding-collection-android
private void init(Context context) {
textSwitcher = new TextSwitcher(context);
textSwitcher.addView(createViewForTextSwitcher(context));
textSwitcher.addView(createViewForTextSwitcher(context));
addView(textSwitcher, new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
textView = new TextView(context);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
textView.setTextAppearance(R.style.positionIndicator);
} else {
textView.setTextAppearance(context, R.style.positionIndicator);
}
addView(textView, new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
}
代码示例来源:origin: zzz40500/android-shapeLoadingView
private void init(Context context, AttributeSet attrs) {
setOrientation(VERTICAL);
mDistance = dip2px(context, 54f);
LayoutInflater.from(context).inflate(R.layout.load_view, this, true);
mShapeLoadingView = (ShapeLoadingView) findViewById(R.id.shapeLoadingView);
mIndicationIm = (ImageView) findViewById(R.id.indication);
mLoadTextView = (TextView) findViewById(R.id.promptTV);
ViewHelper.setScaleX(mIndicationIm, 0.2f);
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.LoadingView);
String loadText = typedArray.getString(R.styleable.LoadingView_loadingText);
int textAppearance = typedArray.getResourceId(R.styleable.LoadingView_loadingText, -1);
mDelay = typedArray.getInteger(R.styleable.LoadingView_delay, 80);
typedArray.recycle();
if (textAppearance != -1) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
mLoadTextView.setTextAppearance(textAppearance);
} else {
mLoadTextView.setTextAppearance(getContext(), textAppearance);
}
}
setLoadingText(loadText);
}
代码示例来源:origin: rey5137/material
int nameTextAppearance = a.getResourceId(R.styleable.ContactView_cv_nameTextAppearance, 0);
if(nameTextAppearance > 0)
mNameView.setTextAppearance(context, nameTextAppearance);
if(nameTextSize > 0)
mNameView.setTextSize(TypedValue.COMPLEX_UNIT_PX, nameTextSize);
int addressTextAppearance = a.getResourceId(R.styleable.ContactView_cv_addressTextAppearance, 0);
if(addressTextAppearance > 0)
mAddressView.setTextAppearance(context, addressTextAppearance);
if(addressTextSize > 0)
mAddressView.setTextSize(TypedValue.COMPLEX_UNIT_PX, addressTextSize);
代码示例来源:origin: robolectric/robolectric
@Test
public void testGetTextAppearanceId() throws Exception {
textView.setTextAppearance(
ApplicationProvider.getApplicationContext(), android.R.style.TextAppearance_Small);
assertThat(shadowOf(textView).getTextAppearanceId()).isEqualTo(android.R.style.TextAppearance_Small);
}
内容来源于网络,如有侵权,请联系作者删除!