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


Java TextPaint.ANTI_ALIAS_FLAG属性代码示例

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


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

示例1: drawText

private void drawText() {
    float x = canvas.getWidth() / 2F;
    float y = canvas.getHeight() * 0.75f;

    Note closest = pitchDifference.closest;
    String note = getNote(closest.getName());
    float offset = textPaint.measureText(note) / 2F;

    String sign = closest.getSign();
    String octave = String.valueOf(getOctave(closest.getOctave()));

    TextPaint paint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
    paint.setColor(Color.BLACK);
    int textSize = (int) (textPaint.getTextSize() / 2);
    paint.setTextSize(textSize);

    float factor = 0.75f;
    if (useScientificNotation) {
        factor = 1.5f;
    }

    canvas.drawText(sign, x + offset * 1.25f, y - offset * factor, paint);
    canvas.drawText(octave, x + offset * 1.25f, y + offset * 0.5f, paint);

    canvas.drawText(note, x - offset, y, textPaint);
}
 
开发者ID:gstraube,项目名称:cythara,代码行数:26,代码来源:CanvasPainter.java

示例2: HintDialogCell

public HintDialogCell(Context context) {
    super(context);
    setBackgroundResource(R.drawable.list_selector);

    imageView = new BackupImageView(context);
    imageView.setRoundRadius(AndroidUtilities.dp(27));
    addView(imageView, LayoutHelper.createFrame(54, 54, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, 7, 0, 0));

    nameTextView = new TextView(context);
    nameTextView.setTypeface(FontManager.instance().getTypeface());
    nameTextView.setTextColor(0xff212121);
    nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12);
    nameTextView.setMaxLines(2);
    nameTextView.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL);
    nameTextView.setLines(2);
    nameTextView.setEllipsize(TextUtils.TruncateAt.END);
    addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 6, 64, 6, 0));

    if (countDrawable == null) {
        countDrawable = getResources().getDrawable(R.drawable.dialogs_badge);
        countDrawableGrey = getResources().getDrawable(R.drawable.dialogs_badge2);

        countPaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
        countPaint.setTextSize(AndroidUtilities.dp(13));
        countPaint.setColor(0xffffffff);
        countPaint.setTypeface(FontManager.instance().getTypeface());
    }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:28,代码来源:HintDialogCell.java

示例3: PopupAudioView

public PopupAudioView(Context context) {
    super(context);
    if (backgroundMediaDrawableIn == null) {
        backgroundMediaDrawableIn = getResources().getDrawable(R.drawable.msg_in_photo);
        statesDrawable[0][0] = getResources().getDrawable(R.drawable.play_g);
        statesDrawable[0][1] = getResources().getDrawable(R.drawable.play_g_s);
        statesDrawable[1][0] = getResources().getDrawable(R.drawable.pause_g);
        statesDrawable[1][1] = getResources().getDrawable(R.drawable.pause_g_s);
        statesDrawable[2][0] = getResources().getDrawable(R.drawable.file_g_load);
        statesDrawable[2][1] = getResources().getDrawable(R.drawable.file_g_load_s);
        statesDrawable[3][0] = getResources().getDrawable(R.drawable.file_g_cancel);
        statesDrawable[3][1] = getResources().getDrawable(R.drawable.file_g_cancel_s);

        statesDrawable[4][0] = getResources().getDrawable(R.drawable.play_b);
        statesDrawable[4][1] = getResources().getDrawable(R.drawable.play_b_s);
        statesDrawable[5][0] = getResources().getDrawable(R.drawable.pause_b);
        statesDrawable[5][1] = getResources().getDrawable(R.drawable.pause_b_s);
        statesDrawable[6][0] = getResources().getDrawable(R.drawable.file_b_load);
        statesDrawable[6][1] = getResources().getDrawable(R.drawable.file_b_load_s);
        statesDrawable[7][0] = getResources().getDrawable(R.drawable.file_b_cancel);
        statesDrawable[7][1] = getResources().getDrawable(R.drawable.file_b_cancel_s);

        timePaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
        timePaint.setTextSize(AndroidUtilities.dp(16));
    }

    TAG = MediaController.getInstance().generateObserverTag();

    seekBar = new SeekBar(getContext());
    seekBar.setDelegate(this);
    progressView = new ProgressView();
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:32,代码来源:PopupAudioView.java

示例4: getHeightS

private int getHeightS() {
    TextPaint textPaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
    textPaint.setTextSize(getTextSize());
    StaticLayout staticLayout = new StaticLayout(textList.get(currentPosition), textPaint, getWidth() - getPaddingLeft() - getPaddingRight(), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0, false);
    int height = staticLayout.getHeight();
    if (staticLayout.getLineCount() > getMaxLines()) {
        int lineCount = staticLayout.getLineCount();
        height = staticLayout.getLineBottom(getMaxLines() - 1);
    }
    return height;
}
 
开发者ID:huashengzzz,项目名称:SmartChart,代码行数:11,代码来源:BannerTextView.java

示例5: CustomHintDialogCell

public CustomHintDialogCell(Context context) {
    super(context);
    setBackgroundResource(R.drawable.list_selector);

    imageView = new BackupImageView(context);
    imageView.setRoundRadius(AndroidUtilities.dp(27));
    addView(imageView, LayoutHelper.createFrame(43, 43, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, 7, 0, 0));

    nameTextView = new TextView(context);
    nameTextView.setTextColor(0xff212121);
    nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 9);
    nameTextView.setMaxLines(2);
    nameTextView.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL);
    nameTextView.setLines(2);
    nameTextView.setEllipsize(TextUtils.TruncateAt.END);
    addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 6, 64, 6, 0));

    if (countDrawable == null) {
        countDrawable = getResources().getDrawable(R.drawable.dialogs_badge);
        countDrawableGrey = getResources().getDrawable(R.drawable.dialogs_badge2);

        countPaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
        countPaint.setColor(0xffffffff);
        countPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    }
    countPaint.setTextSize(AndroidUtilities.dp(11));
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:27,代码来源:CustomHintDialogCell.java

示例6: HintDialogCell

public HintDialogCell(Context context) {
    super(context);
    setBackgroundResource(R.drawable.list_selector);

    imageView = new BackupImageView(context);
    imageView.setRoundRadius(AndroidUtilities.dp(27));
    addView(imageView, LayoutHelper.createFrame(54, 54, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, 7, 0, 0));

    nameTextView = new TextView(context);
    nameTextView.setTextColor(0xff212121);
    nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12);
    nameTextView.setMaxLines(2);
    nameTextView.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL);
    nameTextView.setLines(2);
    nameTextView.setEllipsize(TextUtils.TruncateAt.END);
    addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 6, 64, 6, 0));

    if (countDrawable == null) {
        countDrawable = getResources().getDrawable(R.drawable.dialogs_badge);
        countDrawableGrey = getResources().getDrawable(R.drawable.dialogs_badge2);

        countPaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
        countPaint.setColor(0xffffffff);
        countPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    }
    countPaint.setTextSize(AndroidUtilities.dp(13));
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:27,代码来源:HintDialogCell.java

示例7: PopupAudioView

public PopupAudioView(Context context) {
    super(context);
    if (backgroundMediaDrawableIn == null) {
        backgroundMediaDrawableIn = getResources().getDrawable(R.drawable.msg_in_photo);
        statesDrawable[0][0] = getResources().getDrawable(R.drawable.play_g);
        statesDrawable[0][1] = getResources().getDrawable(R.drawable.play_g_s);
        statesDrawable[1][0] = getResources().getDrawable(R.drawable.pause_g);
        statesDrawable[1][1] = getResources().getDrawable(R.drawable.pause_g_s);
        statesDrawable[2][0] = getResources().getDrawable(R.drawable.file_g_load);
        statesDrawable[2][1] = getResources().getDrawable(R.drawable.file_g_load_s);
        statesDrawable[3][0] = getResources().getDrawable(R.drawable.file_g_cancel);
        statesDrawable[3][1] = getResources().getDrawable(R.drawable.file_g_cancel_s);

        statesDrawable[4][0] = getResources().getDrawable(R.drawable.play_b);
        statesDrawable[4][1] = getResources().getDrawable(R.drawable.play_b_s);
        statesDrawable[5][0] = getResources().getDrawable(R.drawable.pause_b);
        statesDrawable[5][1] = getResources().getDrawable(R.drawable.pause_b_s);
        statesDrawable[6][0] = getResources().getDrawable(R.drawable.file_b_load);
        statesDrawable[6][1] = getResources().getDrawable(R.drawable.file_b_load_s);
        statesDrawable[7][0] = getResources().getDrawable(R.drawable.file_b_cancel);
        statesDrawable[7][1] = getResources().getDrawable(R.drawable.file_b_cancel_s);

        timePaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
    }

    timePaint.setTextSize(AndroidUtilities.dp(16));

    TAG = MediaController.getInstance().generateObserverTag();

    seekBar = new SeekBar(getContext());
    seekBar.setDelegate(this);
    progressView = new ProgressView();
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:33,代码来源:PopupAudioView.java

示例8: init

@Override
public void init(Service service) {

    this.background = service.getResources().getColor(R.color.malvarez_background);

    this.leftHour = service.getResources().getDimension(R.dimen.malvarez_time_hour_left);
    this.topHour = service.getResources().getDimension(R.dimen.malvarez_time_hour_top);
    this.leftMinute = service.getResources().getDimension(R.dimen.malvarez_time_minute_left);
    this.topMinute = service.getResources().getDimension(R.dimen.malvarez_time_minute_top);
    this.leftDate = service.getResources().getDimension(R.dimen.malvarez_date_left);
    this.topDate = service.getResources().getDimension(R.dimen.malvarez_date_top);

    this.hourFont = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
    this.hourFont.setTypeface(ResourceManager.getTypeFace(service.getResources(), ResourceManager.Font.BEBAS_NEUE));
    this.hourFont.setTextSize(service.getResources().getDimension(R.dimen.malvarez_time_font_size));
    this.hourFont.setColor(service.getResources().getColor(R.color.malvarez_time_colour));
    this.hourFont.setTextAlign(Paint.Align.CENTER);

    this.timeFont = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
    this.timeFont.setTypeface(ResourceManager.getTypeFace(service.getResources(), ResourceManager.Font.BEBAS_NEUE));
    this.timeFont.setTextSize(service.getResources().getDimension(R.dimen.malvarez_time_font_size));
    this.timeFont.setColor(service.getResources().getColor(R.color.malvarez_hour_colour));
    this.timeFont.setTextAlign(Paint.Align.CENTER);

    this.dateFont = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
    this.dateFont.setTypeface(ResourceManager.getTypeFace(service.getResources(), ResourceManager.Font.BEBAS_NEUE));
    this.dateFont.setTextSize(service.getResources().getDimension(R.dimen.malvarez_date_font_size));
    this.dateFont.setColor(service.getResources().getColor(R.color.malvarez_time_colour));
    this.dateFont.setTextAlign(Paint.Align.CENTER);
}
 
开发者ID:manuel-alvarez-alvarez,项目名称:malvarez-watchface,代码行数:30,代码来源:MalvarezClock.java

示例9: init

@Override
public void init(Service service) {
    this.textLeft = service.getResources().getDimension(R.dimen.malvarez_heart_rate_text_left);
    this.textTop = service.getResources().getDimension(R.dimen.malvarez_heart_rate_text_top);

    this.textPaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
    this.textPaint.setColor(service.getResources().getColor(R.color.malvarez_time_colour));
    this.textPaint.setTypeface(ResourceManager.getTypeFace(service.getResources(), ResourceManager.Font.BEBAS_NEUE));
    this.textPaint.setTextSize(service.getResources().getDimension(R.dimen.malvarez_circles_font_size));
    this.textPaint.setTextAlign(Paint.Align.CENTER);

    this.heartIcon = service.getResources().getDrawable(R.drawable.heart, null);
    this.setDrawableBounds(this.heartIcon, service.getResources().getDimension(R.dimen.malvarez_heart_rate_icon_left), service.getResources().getDimension(R.dimen.malvarez_heart_rate_icon_top));
}
 
开发者ID:manuel-alvarez-alvarez,项目名称:malvarez-watchface,代码行数:14,代码来源:HeartRateWidget.java


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