context.getTheme.obtainStyledAttributes()和context.obtainStyledAttributes()有什么区别?
主题是指应用的风格吗?
context.getTheme.obtainStyledAttributes()和context.obtainStyledAttributes()有什么区别?
主题是指应用的风格吗?
这是相同的。
在Context.java中。
/**
* Retrieve styled attribute information in this Context's theme. See
* {@link android.content.res.Resources.Theme#obtainStyledAttributes(int[])}
* for more information.
*
* @see android.content.res.Resources.Theme#obtainStyledAttributes(int[])
*/
public final TypedArray obtainStyledAttributes(@StyleableRes int[] attrs) {
return getTheme().obtainStyledAttributes(attrs);
}
context.getTheme.obtainStyledAttributes()
context.obtainStyledAttributes()
和直接调用themeStyle
得到的结果相同,只是后者是一种缩写方式。