Warning Context.obtainStyledAttributes ()

I just spent 3 hours on this problem, so I hope this saves a little time.

public TypedArray obtainStyledAttributes (AttributeSet set, int[] attrs, int defStyleAttr, int defStyleRes) 

The second attrs MUST argument contains the identifiers of the attributes in ascending order, otherwise the attribute value will not be resolved, and the call will fail, as if the attribute did not exist.

This is not a document that I can see, and I needed to find out forever what was going wrong.

+6
source share

Source: https://habr.com/ru/post/917646/


All Articles