本文整理了Java中android.widget.TextView.getResources()
方法的一些代码示例,展示了TextView.getResources()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextView.getResources()
方法的具体详情如下:
包路径:android.widget.TextView
类名称:TextView
方法名:getResources
暂无
代码示例来源:origin: prolificinteractive/material-calendarview
public TitleChanger(TextView title) {
this.title = title;
Resources res = title.getResources();
animDelay = DEFAULT_ANIMATION_DELAY;
animDuration = res.getInteger(android.R.integer.config_shortAnimTime) / 2;
translate = (int) TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP, DEFAULT_Y_TRANSLATION_DP, res.getDisplayMetrics()
);
}
代码示例来源:origin: yanzhenjie/NoHttp
void bindData(FileItem fileItem) {
Album.getAlbumConfig().getAlbumLoader().load(mIvImage, fileItem.getAlbumFile().getPath());
int progress = fileItem.getProgress();
if (progress > 0) {
if (progress >= 100) {
mTvStatus.setText(R.string.form_upload_result);
} else {
mTvStatus.setText(mTvStatus.getResources().getString(R.string.form_progress, progress));
}
} else {
mTvStatus.setText(R.string.form_upload_wait);
}
}
}
代码示例来源:origin: omadahealth/LolliPin
@Override
public void run() {
mErrorTextView.setTextColor(
mErrorTextView.getResources().getColor(R.color.hint_color, null));
mErrorTextView.setText(
mErrorTextView.getResources().getString(R.string.pin_code_fingerprint_text));
mIcon.setImageResource(R.drawable.ic_fp_40px);
}
};
代码示例来源:origin: googlesamples/android-FingerprintDialog
@Override
public void run() {
mErrorTextView.setTextColor(
mErrorTextView.getResources().getColor(R.color.hint_color, null));
mErrorTextView.setText(
mErrorTextView.getResources().getString(R.string.fingerprint_hint));
mIcon.setImageResource(R.drawable.ic_fp_40px);
}
};
代码示例来源:origin: googlesamples/android-FingerprintDialog
@Override
public void onAuthenticationSucceeded(FingerprintManager.AuthenticationResult result) {
mErrorTextView.removeCallbacks(mResetErrorTextRunnable);
mIcon.setImageResource(R.drawable.ic_fingerprint_success);
mErrorTextView.setTextColor(
mErrorTextView.getResources().getColor(R.color.success_color, null));
mErrorTextView.setText(
mErrorTextView.getResources().getString(R.string.fingerprint_success));
mIcon.postDelayed(new Runnable() {
@Override
public void run() {
mCallback.onAuthenticated();
}
}, SUCCESS_DELAY_MILLIS);
}
代码示例来源:origin: omadahealth/LolliPin
/**
* Show an error on the UI using {@link #mIcon} and {@link #mErrorTextView}
*/
private void showError(CharSequence error) {
mIcon.setImageResource(R.drawable.ic_fingerprint_error);
mErrorTextView.setText(error);
mErrorTextView.setTextColor(
mErrorTextView.getResources().getColor(R.color.warning_color, null));
mErrorTextView.removeCallbacks(mResetErrorTextRunnable);
mErrorTextView.postDelayed(mResetErrorTextRunnable, ERROR_TIMEOUT_MILLIS);
}
代码示例来源:origin: googlesamples/android-FingerprintDialog
private void showError(CharSequence error) {
mIcon.setImageResource(R.drawable.ic_fingerprint_error);
mErrorTextView.setText(error);
mErrorTextView.setTextColor(
mErrorTextView.getResources().getColor(R.color.warning_color, null));
mErrorTextView.removeCallbacks(mResetErrorTextRunnable);
mErrorTextView.postDelayed(mResetErrorTextRunnable, ERROR_TIMEOUT_MILLIS);
}
代码示例来源:origin: omadahealth/LolliPin
/**
* Called by {@link FingerprintManager} if the authentication succeeded.
*/
@Override
public void onAuthenticationSucceeded(FingerprintManager.AuthenticationResult result) {
mErrorTextView.removeCallbacks(mResetErrorTextRunnable);
mIcon.setImageResource(R.drawable.ic_fingerprint_success);
mErrorTextView.setTextColor(
mErrorTextView.getResources().getColor(R.color.success_color, null));
mErrorTextView.setText(
mErrorTextView.getResources().getString(R.string.pin_code_fingerprint_success));
mIcon.postDelayed(new Runnable() {
@Override
public void run() {
mCallback.onAuthenticated();
}
}, SUCCESS_DELAY_MILLIS);
}
代码示例来源:origin: stackoverflow.com
View selectedView = spinner.getSelectedView();
if (selectedView != null && selectedView instanceof TextView) {
TextView selectedTextView = (TextView) selectedView;
if (!valid) {
String errorString = selectedTextView.getResources().getString(mErrorStringResource);
selectedTextView.setError(errorString);
}
else {
selectedTextView.setError(null);
}
}
代码示例来源:origin: westnordost/StreetComplete
@Override public void onBind(final QuestVisibility item)
{
this.item = item;
int colorResId = item.isInteractionEnabled() ? android.R.color.white : R.color.greyed_out;
itemView.setBackgroundResource(colorResId);
iconView.setImageResource(item.questType.getIcon());
textView.setText(textView.getResources().getString(item.questType.getTitle(),"…"));
checkBox.setOnCheckedChangeListener(null);
checkBox.setChecked(item.visible);
checkBox.setEnabled(item.isInteractionEnabled());
checkBox.setOnCheckedChangeListener(this);
if(!isEnabledInCurrentCountry())
{
String cc = currentCountryCodes.isEmpty() ? "Atlantis" : currentCountryCodes.get(0);
textCountryDisabled.setText(String.format(
textCountryDisabled.getResources().getString(R.string.questList_disabled_in_country),
new Locale("", cc).getDisplayCountry()
));
textCountryDisabled.setVisibility(View.VISIBLE);
}
else
{
textCountryDisabled.setVisibility(View.GONE);
}
updateSelectionStatus();
}
代码示例来源:origin: stackoverflow.com
@BindingAdapter({"format", "argId"})
public static void setFormattedText(TextView textView, String format, int argId){
if(argId == 0) return;
textView.setText(String.format(format, textView.getResources().getString(argId)));
}
代码示例来源:origin: wasdennnoch/AndroidN-ify
public static void updateFontSize(TextView v, int dimensId) {
if (v != null) {
v.setTextSize(TypedValue.COMPLEX_UNIT_PX,
v.getResources().getDimensionPixelSize(dimensId));
}
}
代码示例来源:origin: advanced-android-book/samples
@Override
public void run() {
mErrorTextView.setTextColor(
mErrorTextView.getResources().getColor(R.color.hint_color, null));
mErrorTextView.setText(
mErrorTextView.getResources().getString(R.string.fingerprint_hint));
mIcon.setImageResource(R.drawable.ic_fp_40px);
}
};
代码示例来源:origin: thealeksandr/PFLockScreen-Android
@Override
public void run() {
mErrorTextView.setTextColor(
mErrorTextView.getResources().getColor(R.color.hint_color, null));
mErrorTextView.setText(
mErrorTextView.getResources().getString(R.string.fingerprint_hint_pf));
mIcon.setImageResource(R.drawable.ic_fp_40px_pf);
}
};
代码示例来源:origin: malmstein/yahnac
private void bindTitle(ViewHolder holder, Story story) {
holder.title.setTextColor(story.isRead() ?
holder.title.getResources().getColor(R.color.grey) :
holder.title.getResources().getColor(R.color.black));
holder.title.setText(story.getTitle());
}
代码示例来源:origin: 8enet/AppOpsX
void bindData(RestoreModel model) {
tvName.setText(model.fileName);
tvTime.setText(Formatter.formatDate(model.createTime));
tvBackCount.setText(tvBackCount.getResources().getString(R.string.backup_count, model.size));
tvFileSize.setText(tvFileSize.getResources()
.getString(R.string.backup_file_size, Formatter.formatFileSize(model.fileSize)));
}
}
代码示例来源:origin: 736008081/frameAndroid
public BaseViewHolder setText(int viewId, CharSequence value, int colorRes) {
TextView view = findViewById(viewId);
view.setText(value);
view.setTextColor(view.getResources().getColor(colorRes));
return this;
}
代码示例来源:origin: stefan-niedermann/nextcloud-deck
/**
* Fills a {@link TextView} with HTML content and activates links in that {@link TextView}.
*
* @param view The {@link TextView} which should be filled.
* @param stringId The string resource containing HTML tags (escaped by <code><</code>)
* @param formatArgs Arguments for the string resource.
*/
public static void setHtml(TextView view, int stringId, Object... formatArgs) {
view.setText(SupportUtil.fromHtml(view.getResources().getString(stringId, formatArgs)));
view.setMovementMethod(LinkMovementMethod.getInstance());
}
代码示例来源:origin: advanced-android-book/samples
private void showError(CharSequence error) {
mIcon.setImageResource(R.drawable.ic_fingerprint_error);
mErrorTextView.setText(error);
mErrorTextView.setTextColor(
mErrorTextView.getResources().getColor(R.color.warning_color, null));
mErrorTextView.removeCallbacks(mResetErrorTextRunnable);
mErrorTextView.postDelayed(mResetErrorTextRunnable, ERROR_TIMEOUT_MILLIS);
}
代码示例来源:origin: renaudcerrato/static-maps-api
@Override
public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
Drawable d = new BitmapDrawable(getView().getResources(), resource);
d = new InsetDrawable(d, dpToPx(ICON_MARGIN));
getView().setCompoundDrawablesWithIntrinsicBounds(d, null, null, null);
}
}
内容来源于网络,如有侵权,请联系作者删除!