当前位置: 首页>>代码示例>>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;未经允许,请勿转载。