/**
* Obtains all attributes from a specific attribute set.
*
* @param attributeSet
* The attribute set, the attributes should be obtained from, as an instance of the type
* {@link AttributeSet} or null, if no attributes should be obtained
* @param defaultStyle
* The default style to apply to this view. If 0, no style will be applied (beyond what
* is included in the theme). This may either be an attribute resource, whose value will
* be retrieved from the current theme, or an explicit style resource
* @param defaultStyleResource
* A resource identifier of a style resource that supplies default values for the view,
* used only if the default style is 0 or can not be found in the theme. Can be 0 to not
* look for defaults
*/
private void obtainStyledAttributes(@Nullable final AttributeSet attributeSet,
@AttrRes final int defaultStyle,
@StyleRes final int defaultStyleResource) {
TypedArray typedArray = getContext()
.obtainStyledAttributes(attributeSet, R.styleable.TabSwitcher, defaultStyle,
defaultStyleResource);
try {
int globalTheme = typedArray.getResourceId(R.styleable.TabSwitcher_themeGlobal, 0);
int phoneTheme = typedArray.getResourceId(R.styleable.TabSwitcher_themePhone, 0);
int tabletTheme = typedArray.getResourceId(R.styleable.TabSwitcher_themeTablet, 0);
themeHelper = new ThemeHelper(getContext(), globalTheme, phoneTheme, tabletTheme);
style = new TabSwitcherStyle(this, model, themeHelper);
obtainLayoutPolicy(typedArray);
obtainBackground(typedArray);
obtainTabIcon(typedArray);
obtainTabBackgroundColor(typedArray);
obtainTabContentBackgroundColor(typedArray);
obtainAddTabButtonColor(typedArray);
obtainTabTitleTextColor(typedArray);
obtainTabCloseButtonIcon(typedArray);
obtainToolbarTitle(typedArray);
obtainToolbarNavigationIcon(typedArray);
obtainToolbarMenu(typedArray);
obtainEmptyView(typedArray);
} finally {
typedArray.recycle();
}
}
TabSwitcher.java 文件源码
java
阅读 40
收藏 0
点赞 0
评论 0
项目:ChromeLikeTabSwitcher
作者:
评论列表
文章目录