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的簡便方法。