Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

android:TextSize attribute is not applied #12

Open
metalurgus opened this issue Jan 5, 2015 · 1 comment
Open

android:TextSize attribute is not applied #12

metalurgus opened this issue Jan 5, 2015 · 1 comment

Comments

@metalurgus
Copy link

metalurgus commented Jan 5, 2015

The problem is inside init(Context context, AttributeSet attrs)method.
readAttrs() should be moved to the top of the method, since setTextSizeis 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
Copy link

You can override the textpaint using setTextPaint until this issue is fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants