2016-08-13 61 views

回答

2

這是一樣的。

在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); 
} 
0
context.getTheme.obtainStyledAttributes() 

context.obtainStyledAttributes()都產生相同的結果,後者僅僅是在不直接調用themeStyle的簡便方法。