本文整理匯總了Java中android.widget.TextView.getResources方法的典型用法代碼示例。如果您正苦於以下問題:Java TextView.getResources方法的具體用法?Java TextView.getResources怎麽用?Java TextView.getResources使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.TextView
的用法示例。
在下文中一共展示了TextView.getResources方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onPostExecute
import android.widget.TextView; //導入方法依賴的package包/類
@Override
protected void onPostExecute(Bitmap result) {
if (result == null) {
return;
}
if (mTextViewRef.get() == null) {
return;
}
TextView textView = mTextViewRef.get();
// change the reference of the current mDrawable to the result
// from the HTTP call
mUrlDrawable.mDrawable = new BitmapDrawable(textView.getResources(), result);
// set bound to scale image to fit width and keep aspect ratio
// according to the result from HTTP call
int width = textView.getWidth();
int height = Math.round(1.0f * width *
mUrlDrawable.mDrawable.getIntrinsicHeight() /
mUrlDrawable.mDrawable.getIntrinsicWidth());
mUrlDrawable.setBounds(0, 0, width, height);
mUrlDrawable.mDrawable.setBounds(0, 0, width, height);
// force redrawing bitmap by setting text
textView.setText(textView.getText());
}
示例2: loadFromMemory
import android.widget.TextView; //導入方法依賴的package包/類
@NonNull
private Drawable loadFromMemory(ImageHolder holder, TextView textView, DrawableWrapper drawableWrapper) {
BitmapWrapper bitmapWrapper = BitmapPool.getPool().get(holder.getKey(), false, true);
Bitmap bitmap = bitmapWrapper.getBitmap();
BitmapDrawable bitmapDrawable = new BitmapDrawable(textView.getResources(), bitmap);
bitmapDrawable.setBounds(0, 0, bitmap.getWidth(), bitmap.getHeight());
drawableWrapper.setDrawable(bitmapDrawable);
BitmapWrapper.SizeCacheHolder sizeCacheHolder = bitmapWrapper.getSizeCacheHolder();
drawableWrapper.setBounds(sizeCacheHolder.rect);
drawableWrapper.setScaleType(sizeCacheHolder.scaleType);
drawableWrapper.calculate();
return drawableWrapper;
}
示例3: TitleChanger
import android.widget.TextView; //導入方法依賴的package包/類
public TitleChanger(TextView title) {
this.title = title;
Resources res = title.getResources();
this.animDelay = 400;
this.animDuration = res.getInteger(17694720) / 2;
this.yTranslate = (int) TypedValue.applyDimension(1, 20.0f, res.getDisplayMetrics());
}
示例4: SuggestionStripLayoutHelper
import android.widget.TextView; //導入方法依賴的package包/類
public SuggestionStripLayoutHelper(final Context context, final AttributeSet attrs,
final int defStyle, final ArrayList<TextView> wordViews,
final ArrayList<View> dividerViews, final ArrayList<TextView> debugInfoViews) {
mWordViews = wordViews;
mDividerViews = dividerViews;
mDebugInfoViews = debugInfoViews;
final TextView wordView = wordViews.get(0);
final View dividerView = dividerViews.get(0);
mPadding = wordView.getCompoundPaddingLeft() + wordView.getCompoundPaddingRight();
dividerView.measure(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
mDividerWidth = dividerView.getMeasuredWidth();
final Resources res = wordView.getResources();
mSuggestionsStripHeight = res.getDimensionPixelSize(
R.dimen.config_suggestions_strip_height);
final TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.SuggestionStripView, defStyle, R.style.SuggestionStripView);
mSuggestionStripOptions = a.getInt(
R.styleable.SuggestionStripView_suggestionStripOptions, 0);
mAlphaObsoleted = ResourceUtils.getFraction(a,
R.styleable.SuggestionStripView_alphaObsoleted, 1.0f);
mColorValidTypedWord = a.getColor(R.styleable.SuggestionStripView_colorValidTypedWord, 0);
mColorTypedWord = a.getColor(R.styleable.SuggestionStripView_colorTypedWord, 0);
mColorAutoCorrect = a.getColor(R.styleable.SuggestionStripView_colorAutoCorrect, 0);
mColorSuggested = a.getColor(R.styleable.SuggestionStripView_colorSuggested, 0);
mSuggestionsCountInStrip = a.getInt(
R.styleable.SuggestionStripView_suggestionsCountInStrip,
DEFAULT_SUGGESTIONS_COUNT_IN_STRIP);
mCenterSuggestionWeight = ResourceUtils.getFraction(a,
R.styleable.SuggestionStripView_centerSuggestionPercentile,
DEFAULT_CENTER_SUGGESTION_PERCENTILE);
mMaxMoreSuggestionsRow = a.getInt(
R.styleable.SuggestionStripView_maxMoreSuggestionsRow,
DEFAULT_MAX_MORE_SUGGESTIONS_ROW);
mMinMoreSuggestionsWidth = ResourceUtils.getFraction(a,
R.styleable.SuggestionStripView_minMoreSuggestionsWidth, 1.0f);
a.recycle();
mMoreSuggestionsHint = getMoreSuggestionsHint(res,
res.getDimension(R.dimen.config_more_suggestions_hint_text_size),
mColorAutoCorrect);
mCenterPositionInStrip = mSuggestionsCountInStrip / 2;
// Assuming there are at least three suggestions. Also, note that the suggestions are
// laid out according to script direction, so this is left of the center for LTR scripts
// and right of the center for RTL scripts.
mTypedWordPositionWhenAutocorrect = mCenterPositionInStrip - 1;
mMoreSuggestionsBottomGap = res.getDimensionPixelOffset(
R.dimen.config_more_suggestions_bottom_gap);
mMoreSuggestionsRowHeight = res.getDimensionPixelSize(
R.dimen.config_more_suggestions_row_height);
}
示例5: TitleChanger
import android.widget.TextView; //導入方法依賴的package包/類
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()
);
}