android:TextSize attribute is not applied
metalurgus opened this issue · 1 comments
metalurgus commented
The problem is inside init(Context context, AttributeSet attrs)
method.
readAttrs()
should be moved to the top of the method, since setTextSize
is applied before attribute is being read. This is how it should look like:
private void init(Context context, AttributeSet attrs) {
if (attrs != null) {
readAttrs(context, attrs);
}
mTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
mTextPaint.density = getResources().getDisplayMetrics().density;
mTextPaint.setTextSize(mTextsize);
mTextPaint.setColor(Color.BLACK);
mLinkPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
mLinkPaint.density = getResources().getDisplayMetrics().density;
mLinkPaint.setTextSize(mTextsize);
mLinkPaint.setColor(Color.BLUE);
mLinkPaint.setUnderlineText(true);
this.setBackgroundColor(Color.TRANSPARENT);
this.setOnTouchListener(mClickHandler);
}
skhanzada commented
You can override the textpaint using setTextPaint until this issue is fixed.