当前位置: 首页>>代码示例>>Java>>正文


Java TextPaint.setFakeBoldText方法代码示例

本文整理汇总了Java中android.text.TextPaint.setFakeBoldText方法的典型用法代码示例。如果您正苦于以下问题:Java TextPaint.setFakeBoldText方法的具体用法?Java TextPaint.setFakeBoldText怎么用?Java TextPaint.setFakeBoldText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.text.TextPaint的用法示例。


在下文中一共展示了TextPaint.setFakeBoldText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addTab

import android.text.TextPaint; //导入方法依赖的package包/类
/**
 * 添加指示器
 *
 * @param position
 * @param title
 */
private void addTab(final int position, CharSequence title) {
    TextView tvTab = new TextView(context);
    tvTab.setText(title);
    tvTab.setTextColor(textColor);
    tvTab.setTextSize(textSize);
    tvTab.setGravity(Gravity.CENTER);
    if(isIndicatorTextBold){
        TextPaint tp = tvTab.getPaint();
        tp.setFakeBoldText(true);
    }
    tvTab.setSingleLine();
    tvTab.setFocusable(true);
    tvTab.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            viewPager.setCurrentItem(position);
        }
    });
    tvTab.setPadding(indicatorMargin, 0, indicatorMargin, 0);
    container.addView(tvTab, position, expandedTabLayoutParams);
}
 
开发者ID:xfangfang,项目名称:NeuTV,代码行数:28,代码来源:TabStrip.java

示例2: apply

import android.text.TextPaint; //导入方法依赖的package包/类
private void apply(TextPaint paint) {
    int oldStyle;
    Typeface old = paint.getTypeface();
    if (old == null) {
        oldStyle = 0;
    } else {
        oldStyle = old.getStyle();
    }
    final int fakeStyle = oldStyle & ~typeface.getStyle();

    if ((fakeStyle & Typeface.BOLD) != 0) {
        paint.setFakeBoldText(true);
    }

    if ((fakeStyle & Typeface.ITALIC) != 0) {
        paint.setTextSkewX(-0.25f);
    }

    paint.setTypeface(typeface);
}
 
开发者ID:suragch,项目名称:mongol-library,代码行数:21,代码来源:MongolTypefaceSpan.java

示例3: RoundedIconGenerator

import android.text.TextPaint; //导入方法依赖的package包/类
/**
 * Constructs the generator and initializes the common members ignoring display density.
 *
 * @param iconWidthPx The width of the generated icon in pixels.
 * @param iconHeightPx The height of the generated icon in pixels.
 * @param cornerRadiusPx The radius of the corners in the icon in pixels.
 * @param backgroundColor Color at which the rounded rectangle should be drawn.
 * @param textSizePx Size at which the text should be drawn in pixels.
 */
public RoundedIconGenerator(int iconWidthPx, int iconHeightPx, int cornerRadiusPx,
        int backgroundColor, float textSizePx) {
    mIconWidthPx = iconWidthPx;
    mIconHeightPx = iconHeightPx;
    mCornerRadiusPx = cornerRadiusPx;

    mBackgroundRect = new RectF(0, 0, mIconWidthPx, mIconHeightPx);

    mBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mBackgroundPaint.setColor(backgroundColor);

    mTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
    mTextPaint.setColor(Color.WHITE);
    mTextPaint.setFakeBoldText(true);
    mTextPaint.setTextSize(textSizePx);

    FontMetrics textFontMetrics = mTextPaint.getFontMetrics();
    mTextHeight = (float) Math.ceil(textFontMetrics.bottom - textFontMetrics.top);
    mTextYOffset = -textFontMetrics.top;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:30,代码来源:RoundedIconGenerator.java

示例4: build

import android.text.TextPaint; //导入方法依赖的package包/类
@Override
public Builder build() {
    //Set the keyboard paint
    mKeyPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mKeyPaint.setStyle(Paint.Style.STROKE);
    mKeyPaint.setColor(mKeyStrokeColor);
    mKeyPaint.setTextSize(mKeyTextSize);
    mKeyPaint.setStrokeWidth(mKeyStrokeWidth);

    //Set the keyboard text paint
    mKeyTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
    mKeyTextPaint.setColor(mKeyTextColor);
    mKeyTextPaint.setTextSize(mKeyTextSize);
    mKeyTextPaint.setFakeBoldText(true);
    mKeyTextPaint.setTextAlign(Paint.Align.CENTER);

    //Ripple paint
    mClickPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mClickPaint.setStyle(Paint.Style.STROKE);
    mClickPaint.setColor(Utils.makeColorDark(mKeyStrokeColor));
    mClickPaint.setStrokeWidth(mKeyStrokeWidth);
    return this;
}
 
开发者ID:kevalpatel2106,项目名称:PasscodeView,代码行数:24,代码来源:SquareKey.java

示例5: build

import android.text.TextPaint; //导入方法依赖的package包/类
@Override
public Builder build() {
    //Set the keyboard paint
    mKeyPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mKeyPaint.setStyle(Paint.Style.STROKE);
    mKeyPaint.setColor(mKeyStrokeColor);
    mKeyPaint.setTextSize(mKeyTextSize);
    mKeyPaint.setStrokeWidth(mKeyStrokeWidth);

    //Set the keyboard text paint
    mKeyTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
    mKeyTextPaint.setColor(mKeyTextColor);
    mKeyTextPaint.setTextSize(mKeyTextSize);
    mKeyTextPaint.setFakeBoldText(true);
    mKeyTextPaint.setTextAlign(Paint.Align.CENTER);

    return this;
}
 
开发者ID:kevalpatel2106,项目名称:PasscodeView,代码行数:19,代码来源:RoundKey.java

示例6: getView

import android.text.TextPaint; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder viewHolder = null;
    if (convertView == null) {
        convertView = mLayoutInflater.inflate(R.layout.local_audio_item, parent, false);
        viewHolder = new ViewHolder();
        viewHolder.thumbnail = (ImageView) convertView.
                findViewById(R.id.iv_local_video_thumbnail);
        viewHolder.displayName = (TextView) convertView.
                findViewById(R.id.tv_local_video_display_name);
        viewHolder.duration = (TextView) convertView.
                findViewById(R.id.tv_local_video_duration);
        viewHolder.size = (TextView) convertView.
                findViewById(R.id.tv_local_video_size);
        convertView.setTag(viewHolder);
    } else {
        viewHolder = (ViewHolder) convertView.getTag();
    }
    MediaItem mediaItem = (MediaItem) getItem(position);
    viewHolder.displayName.setText(mediaItem.getDisplayName());
    TextPaint paint = viewHolder.displayName.getPaint();
    paint.setFakeBoldText(true);
    viewHolder.duration.setText(TimeUtils.toTimeStr(mediaItem.getDuration()));
    viewHolder.size.setText(SizeUtils.toSizeStr(mediaItem.getSize()));
    return convertView;
}
 
开发者ID:iPanelkegy,项目名称:MobileMedia,代码行数:27,代码来源:LocalAudioAdapter.java

示例7: TitleBitmapFactory

import android.text.TextPaint; //导入方法依赖的package包/类
/**
 * @param context   The current Android's context.
 * @param incognito Whether the title are for incognito mode.
 * @param nullFaviconResourceId A drawable resource id of a default favicon.
 */
public TitleBitmapFactory(Context context, boolean incognito, int nullFaviconResourceId) {
    mNullFaviconResourceId = nullFaviconResourceId;

    Resources res = context.getResources();
    int textColor = ApiCompatibilityUtils.getColor(res, incognito
            ? R.color.compositor_tab_title_bar_text_incognito
            : R.color.compositor_tab_title_bar_text);
    float textSize = res.getDimension(R.dimen.compositor_tab_title_text_size);

    boolean fakeBoldText = res.getBoolean(R.bool.compositor_tab_title_fake_bold_text);

    mTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
    mTextPaint.setColor(textColor);

    mTextPaint.setTextSize(textSize);
    mTextPaint.setFakeBoldText(fakeBoldText);
    mTextPaint.density = res.getDisplayMetrics().density;

    FontMetrics textFontMetrics = mTextPaint.getFontMetrics();
    mTextHeight = (float) Math.ceil(textFontMetrics.bottom - textFontMetrics.top);
    mTextYOffset = -textFontMetrics.top;

    mFaviconDimension = res.getDimensionPixelSize(R.dimen.compositor_tab_title_favicon_size);
    mViewHeight = (int) Math.max(mFaviconDimension, mTextHeight);

    int width = res.getDisplayMetrics().widthPixels;
    int height = res.getDisplayMetrics().heightPixels;
    mMaxWidth = (int) (TITLE_WIDTH_PERCENTAGE * Math.max(width, height));

    // Set the favicon dimension here.
    mFaviconDimension = Math.min(mMaxWidth, mFaviconDimension);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:38,代码来源:TitleBitmapFactory.java

示例8: getView

import android.text.TextPaint; //导入方法依赖的package包/类
public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder;
    boolean z = true;
    if (convertView == null) {
        holder = new ViewHolder();
        convertView = LayoutInflater.from(this.mContext).inflate(R.layout.garbage_file_item, null);
        ViewHolder.access$002(holder, (TextView) convertView.findViewById(R.id.tv_garbage_file_item_type));
        ViewHolder.access$102(holder, (TextView) convertView.findViewById(R.id.tv_garbage_file_item_size));
        ViewHolder.access$202(holder, (ImageView) convertView.findViewById(R.id.iv_garbage_file_selection));
        convertView.setTag(holder);
    } else {
        holder = (ViewHolder) convertView.getTag();
    }
    if (!(this.mList == null || this.mList.get(position) == null)) {
        boolean z2;
        ViewHolder.access$000(holder).setText(getNameByType(((GarbageFileInfo) this.mList.get(position)).type));
        TextPaint tp = ViewHolder.access$000(holder).getPaint();
        if (position == 0) {
            z2 = true;
        } else {
            z2 = false;
        }
        tp.setFakeBoldText(z2);
        tp = ViewHolder.access$100(holder).getPaint();
        if (position != 0) {
            z = false;
        }
        tp.setFakeBoldText(z);
        StringBuilder sb = new StringBuilder();
        sb.append(GarbageCleanActivity.transformShortType(((GarbageFileInfo) this.mList.get(position)).size));
        sb.append(GarbageCleanActivity.transformUnit(((GarbageFileInfo) this.mList.get(position)).size));
        ViewHolder.access$100(holder).setText(sb.toString());
    }
    if (this.mGarbageFileTypeSelectionList.contains(((GarbageFileInfo) this.mList.get(position)).type)) {
        ViewHolder.access$200(holder).setVisibility(0);
    } else {
        ViewHolder.access$200(holder).setVisibility(4);
    }
    return convertView;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:41,代码来源:GarbageFileListAdapter.java

示例9: updateDrawState

import android.text.TextPaint; //导入方法依赖的package包/类
@Override
public void updateDrawState(TextPaint ds) {
    //log("TagSpan:updateDrawState:" + isPreDeleteState);
    ds.setFakeBoldText(true);
    if (willRemove) {
        ds.setColor(0xFFFFFFFF);
        ds.bgColor = 0xFF24cf5f;
    } else {
        super.updateDrawState(ds);
    }
}
 
开发者ID:hsj-xiaokang,项目名称:OSchina_resources_android,代码行数:12,代码来源:RichEditText.java

示例10: setSwitchTypeface

import android.text.TextPaint; //导入方法依赖的package包/类
public void setSwitchTypeface(Typeface tf, int style) {
    boolean z = false;
    if (style > 0) {
        int typefaceStyle;
        float f;
        if (tf == null) {
            tf = Typeface.defaultFromStyle(style);
        } else {
            tf = Typeface.create(tf, style);
        }
        setSwitchTypeface(tf);
        if (tf != null) {
            typefaceStyle = tf.getStyle();
        } else {
            typefaceStyle = 0;
        }
        int need = style & (typefaceStyle ^ -1);
        TextPaint textPaint = this.mTextPaint;
        if ((need & 1) != 0) {
            z = true;
        }
        textPaint.setFakeBoldText(z);
        textPaint = this.mTextPaint;
        if ((need & 2) != 0) {
            f = -0.25f;
        } else {
            f = 0.0f;
        }
        textPaint.setTextSkewX(f);
        return;
    }
    this.mTextPaint.setFakeBoldText(false);
    this.mTextPaint.setTextSkewX(0.0f);
    setSwitchTypeface(tf);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:36,代码来源:SwitchCompat.java

示例11: setTopTitleBold

import android.text.TextPaint; //导入方法依赖的package包/类
protected void setTopTitleBold(String title) {
	if (title == null) {
		return;
	}
	if (title.length() > 12) {
		title = title.substring(0, 11) + "...";
	}
	// 设置字体为加粗
	TextPaint paint =  topTitleTxt.getPaint();  
	paint.setFakeBoldText(true); 
	
	topTitleTxt.setText(title);
	topTitleTxt.setVisibility(View.VISIBLE);
			
}
 
开发者ID:ccfish86,项目名称:sctalk,代码行数:16,代码来源:TTBaseFragment.java

示例12: init

import android.text.TextPaint; //导入方法依赖的package包/类
private void init() {
    setContentView(R.layout.dialog_alert);

    this.mTitleView = (TextView) findViewById(R.id.title);
    final TextPaint tp = this.mTitleView.getPaint();
    tp.setFakeBoldText(true);
    this.mTitleView.setText(this.mTitle);

    this.mTextView = (TextView) findViewById(R.id.text);
    this.mTextView.setText(this.mText);

    this.mButtonOk = (Button) findViewById(R.id.button_ok);
    this.mButtonOk.setOnClickListener(this);

}
 
开发者ID:blxble,项目名称:mesh-core-on-android,代码行数:16,代码来源:AlertInfoDialog.java

示例13: getView

import android.text.TextPaint; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder viewHolder = null;
    if (convertView == null) {
        convertView = mLayoutInflater.inflate(R.layout.local_video_item, parent, false);
        viewHolder = new ViewHolder();
        viewHolder.thumbnail = (ImageView) convertView.
                findViewById(R.id.iv_local_video_thumbnail);
        viewHolder.displayName = (TextView) convertView.
                findViewById(R.id.tv_local_video_display_name);
        viewHolder.duration = (TextView) convertView.
                findViewById(R.id.tv_local_video_duration);
        viewHolder.size = (TextView) convertView.
                findViewById(R.id.tv_local_video_size);
        convertView.setTag(viewHolder);
    } else {
        viewHolder = (ViewHolder) convertView.getTag();
    }
    MediaItem mediaItem = (MediaItem) getItem(position);
    ImageLoader.bindVideoThumbnailWithPath(mediaItem.getPath(), viewHolder.thumbnail);
    viewHolder.displayName.setText(mediaItem.getDisplayName());
    viewHolder.displayName.setText(mediaItem.getDisplayName());
    TextPaint paint = viewHolder.displayName.getPaint();
    paint.setFakeBoldText(true);
    viewHolder.duration.setText(TimeUtils.toTimeStr(mediaItem.getDuration()));
    viewHolder.size.setText(SizeUtils.toSizeStr(mediaItem.getSize()));
    return convertView;
}
 
开发者ID:iPanelkegy,项目名称:MobileMedia,代码行数:29,代码来源:LocalVideoAdapter.java

示例14: setBold

import android.text.TextPaint; //导入方法依赖的package包/类
public static void setBold(TextView textView) {
    if (textView != null) {
        TextPaint paint = textView.getPaint();
        paint.setFakeBoldText(true);
    }
}
 
开发者ID:hsllany,项目名称:HtmlNative,代码行数:7,代码来源:StyleHelper.java

示例15: setFakeBold

import android.text.TextPaint; //导入方法依赖的package包/类
public static void setFakeBold(TextView textView, boolean isBold)
{
    TextPaint tp = textView.getPaint();
    tp.setFakeBoldText(isBold);
}
 
开发者ID:zhuyu1022,项目名称:amap,代码行数:6,代码来源:MIP_TextStyle.java


注:本文中的android.text.TextPaint.setFakeBoldText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。