Java Code Examples for android.text.TextPaint#setLinearText()
The following examples show how to use
android.text.TextPaint#setLinearText() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RoundLetterView.java From MultiContactPicker with Apache License 2.0 | 5 votes |
private void init(AttributeSet attrs, int defStyle) { final TypedArray a = getContext().obtainStyledAttributes( attrs, R.styleable.RoundedLetterView, defStyle, 0); if(a.hasValue(R.styleable.RoundedLetterView_rlv_titleText)){ mTitleText = a.getString(R.styleable.RoundedLetterView_rlv_titleText); } mTitleColor = a.getColor(R.styleable.RoundedLetterView_rlv_titleColor,DEFAULT_TITLE_COLOR); mBackgroundColor = a.getColor(R.styleable.RoundedLetterView_rlv_backgroundColorValue,DEFAULT_BACKGROUND_COLOR); mTitleSize = a.getDimension(R.styleable.RoundedLetterView_rlv_titleSize,DEFAULT_TITLE_SIZE); a.recycle(); //Title TextPaint mTitleTextPaint = new TextPaint(); mTitleTextPaint.setFlags(Paint.ANTI_ALIAS_FLAG); mTitleTextPaint.setTypeface(mFont); mTitleTextPaint.setTextAlign(Paint.Align.CENTER); mTitleTextPaint.setLinearText(true); mTitleTextPaint.setColor(mTitleColor); mTitleTextPaint.setTextSize(mTitleSize); //Background Paint mBackgroundPaint = new Paint(); mBackgroundPaint.setFlags(Paint.ANTI_ALIAS_FLAG); mBackgroundPaint.setStyle(Paint.Style.FILL); mBackgroundPaint.setColor(mBackgroundColor); mInnerRectF = new RectF(); }
Example 2
Source File: RoundedLetterView.java From RoundedLetterView with Apache License 2.0 | 5 votes |
private void init(AttributeSet attrs, int defStyle) { final TypedArray a = getContext().obtainStyledAttributes( attrs, R.styleable.RoundedLetterView, defStyle, 0); if(a.hasValue(R.styleable.RoundedLetterView_rlv_titleText)){ mTitleText = a.getString(R.styleable.RoundedLetterView_rlv_titleText); } mTitleColor = a.getColor(R.styleable.RoundedLetterView_rlv_titleColor,DEFAULT_TITLE_COLOR); mBackgroundColor = a.getColor(R.styleable.RoundedLetterView_rlv_backgroundColorValue,DEFAULT_BACKGROUND_COLOR); mTitleSize = a.getDimension(R.styleable.RoundedLetterView_rlv_titleSize,DEFAULT_TITLE_SIZE); a.recycle(); //Title TextPaint mTitleTextPaint = new TextPaint(); mTitleTextPaint.setFlags(Paint.ANTI_ALIAS_FLAG); mTitleTextPaint.setTypeface(mFont); mTitleTextPaint.setTextAlign(Paint.Align.CENTER); mTitleTextPaint.setLinearText(true); mTitleTextPaint.setColor(mTitleColor); mTitleTextPaint.setTextSize(mTitleSize); //Background Paint mBackgroundPaint = new Paint(); mBackgroundPaint.setFlags(Paint.ANTI_ALIAS_FLAG); mBackgroundPaint.setStyle(Paint.Style.FILL); mBackgroundPaint.setColor(mBackgroundColor); mInnerRectF = new RectF(); }