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


Java TextView.getResources方法代碼示例

本文整理匯總了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());
}
 
開發者ID:didikee,項目名稱:cnBetaGeek,代碼行數:24,代碼來源:LoadFromUriAsyncTask.java

示例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;
}
 
開發者ID:nichbar,項目名稱:Aequorea,代碼行數:14,代碼來源:DefaultImageGetter.java

示例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());
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:8,代碼來源:TitleChanger.java

示例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);
}
 
開發者ID:sergeychilingaryan,項目名稱:AOSP-Kayboard-7.1.2,代碼行數:55,代碼來源:SuggestionStripLayoutHelper.java

示例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()
    );
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:14,代碼來源:TitleChanger.java


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