本文整理匯總了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);
}
示例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());
}
}
示例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();
}
示例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;
}
示例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));
}
示例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));
}
示例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();
}
示例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);
}
示例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));
}