0

I'm trying to extract the value set on this attribut <item name="android:textStyle">bold</item>

According to the documentation the return values for this attribut are

Normal: 0

Bold: 1

Italic: 2

But I'm always getting 0 for styleVal no matter what is passed in the textStyle! Everything in the code seems correcet and I can't debug the error

    private void getTextViewStyleValue() {

            int[] AttrSet = {
            android.R.attr.textColor,
            android.R.attr.textStyle,
            android.R.attr.fontFamily,
    };

    TypedArray a = context.obtainStyledAttributes(style, AttrSet);

    textColor = a.getColor(0, DEFAULT_TEXT_COLOR);

    int styleVal = a.getInt(1, 0);

    font = Typeface.createFromAsset(context.getAssets(), a.getString(2));

    a.recycle();

}

This is what is written about android.R.attr.textStyle's value

enter image description here

0 Answers0