View类中context.getTheme.obtainStyledAttributes和context.obtainStyledAttributes的区别

3

context.getTheme.obtainStyledAttributes()和context.obtainStyledAttributes()有什么区别?

主题是指应用的风格吗?

2个回答

7

这是相同的。

在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);
}

4
context.getTheme.obtainStyledAttributes()

context.obtainStyledAttributes()和直接调用themeStyle得到的结果相同,只是后者是一种缩写方式。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接