context.getTheme.obtainStyledAttributes()
和context.obtainStyledAttributes()
之间的区别是什么?View类中的context.getTheme.obtainStyledAttributes和context.obtainStyledAttributes之间的差别
是主题是我的应用程序样式?
context.getTheme.obtainStyledAttributes()
和context.obtainStyledAttributes()
之间的区别是什么?View类中的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的简便方法。