List of usage examples for android.content.res TypedArray getDimensionPixelSize
public int getDimensionPixelSize(@StyleableRes int index, int defValue)
From source file:com.albedinsky.android.support.ui.widget.ViewPagerWidget.java
/** * Creates a new instance of ViewPagerWidget within the given <var>context</var>. * * @param context Context in which will be this view presented. * @param attrs Set of Xml attributes used to configure the new instance of this view. * @param defStyleAttr An attribute which contains a reference to a default style resource for * this view within a theme of the given context. *//*from w ww .j a v a2 s . co m*/ public ViewPagerWidget(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs); /** * Process attributes. */ final TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.Ui_Widget_ViewPager, defStyleAttr, 0); if (typedArray != null) { this.ensurePullController(); mPullController.setUpFromAttrs(context, attrs, defStyleAttr); final int n = typedArray.getIndexCount(); for (int i = 0; i < n; i++) { final int index = typedArray.getIndex(i); if (index == R.styleable.Ui_Widget_ViewPager_android_background) { int resID = typedArray.getResourceId(index, -1); if (resID != -1) { setBackgroundResource(resID); } else { setBackgroundColor(typedArray.getColor(0, Color.TRANSPARENT)); } } else if (index == R.styleable.Ui_Widget_ViewPager_uiPageMargin) { setPageMargin(typedArray.getDimensionPixelSize(index, 0)); } else if (index == R.styleable.Ui_Widget_ViewPager_uiPageMarginDrawable) { setPageMarginDrawable(typedArray.getDrawable(index)); } else if (index == R.styleable.Ui_Widget_ViewPager_uiPageSwipingEnabled) { updatePrivateFlags(PFLAG_PAGE_SWIPING_ENABLED, typedArray.getBoolean(index, true)); } else if (index == R.styleable.Ui_Widget_ViewPager_uiPageFlingSwipingEnabled) { updatePrivateFlags(PFLAG_PAGE_FLING_SWIPING_ENABLED, typedArray.getBoolean(index, false)); } else if (index == R.styleable.Ui_Widget_ViewPager_uiPageFlingSwipingSensitivity) { this.mPageFlingSwipingSensitivity = Math.max(0, typedArray.getFloat(index, mPageFlingSwipingSensitivity)); } else if (index == R.styleable.Ui_Widget_ViewPager_uiCurrentPage) { this.mCurrentPage = typedArray.getInteger(index, 0); } else if (index == R.styleable.Ui_Widget_ViewPager_uiOffScreenPageLimit) { setOffscreenPageLimit(typedArray.getInt(index, getOffscreenPageLimit())); } else if (index == R.styleable.Ui_Widget_ViewPager_uiPageScrollDuration) { this.mPageScrollDuration = typedArray.getInteger(index, mPageScrollDuration); } else if (index == R.styleable.Ui_Widget_ViewPager_uiPageScrollRelativeDurationEnabled) { updatePrivateFlags(PFLAG_PAGE_SCROLL_RELATIVE_DURATION_ENABLED, typedArray.getBoolean(index, false)); } else if (index == R.styleable.Ui_Widget_ViewPager_uiPullEnabled) { setPullEnabled(typedArray.getBoolean(index, false)); } } } // Override default scroller so we can use custom durations for scroll if requested. this.mScroller = new WidgetScroller(context, SCROLLER_INTERPOLATOR); }
From source file:com.muzakki.ahmad.widget.CollapsingToolbarLayout.java
public CollapsingToolbarLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); ThemeUtils.checkAppCompatTheme(context); mCollapsingTextHelper = new CollapsingTextHelper(this); mCollapsingTextHelper.setTextSizeInterpolator(AnimationUtils.DECELERATE_INTERPOLATOR); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CollapsingToolbarLayout, defStyleAttr, R.style.Widget_Design_CollapsingToolbar); mCollapsingTextHelper.setExpandedTextGravity(a.getInt( R.styleable.CollapsingToolbarLayout_expandedTitleGravity, GravityCompat.START | Gravity.BOTTOM)); mCollapsingTextHelper//from w w w . j a v a 2 s.com .setCollapsedTextGravity(a.getInt(R.styleable.CollapsingToolbarLayout_collapsedTitleGravity, GravityCompat.START | Gravity.CENTER_VERTICAL)); mExpandedMarginStart = mExpandedMarginTop = mExpandedMarginEnd = mExpandedMarginBottom = a .getDimensionPixelSize(R.styleable.CollapsingToolbarLayout_expandedTitleMargin, 0); if (a.hasValue(R.styleable.CollapsingToolbarLayout_expandedTitleMarginStart)) { mExpandedMarginStart = a .getDimensionPixelSize(R.styleable.CollapsingToolbarLayout_expandedTitleMarginStart, 0); } if (a.hasValue(R.styleable.CollapsingToolbarLayout_expandedTitleMarginEnd)) { mExpandedMarginEnd = a.getDimensionPixelSize(R.styleable.CollapsingToolbarLayout_expandedTitleMarginEnd, 0); } if (a.hasValue(R.styleable.CollapsingToolbarLayout_expandedTitleMarginTop)) { mExpandedMarginTop = a.getDimensionPixelSize(R.styleable.CollapsingToolbarLayout_expandedTitleMarginTop, 0); } if (a.hasValue(R.styleable.CollapsingToolbarLayout_expandedTitleMarginBottom)) { mExpandedMarginBottom = a .getDimensionPixelSize(R.styleable.CollapsingToolbarLayout_expandedTitleMarginBottom, 0); } mCollapsingTitleEnabled = a.getBoolean(R.styleable.CollapsingToolbarLayout_titleEnabled, true); setTitle(a.getText(R.styleable.CollapsingToolbarLayout_title)); // begin modification TypedArray mStyle = context.obtainStyledAttributes(attrs, R.styleable.SubtitleCollapsingToolbar, defStyleAttr, R.style.SubtitleCollapsingToolbar); if (mStyle.hasValue(R.styleable.SubtitleCollapsingToolbar_subtitle)) setSubtitle(mStyle.getText(R.styleable.SubtitleCollapsingToolbar_subtitle).toString()); //load default appearances first mCollapsingTextHelper.setCollapsedSubAppearance(R.style.CollapsedSubtitleAppearance); mCollapsingTextHelper.setExpandedSubAppearance(R.style.ExpandedSubtitleAppearance); // now apply custom sub appearance if (mStyle.hasValue(R.styleable.SubtitleCollapsingToolbar_collapsedSubtitleAppearance)) { mCollapsingTextHelper.setCollapsedSubAppearance( mStyle.getResourceId(R.styleable.SubtitleCollapsingToolbar_collapsedSubtitleAppearance, 0)); } if (mStyle.hasValue(R.styleable.SubtitleCollapsingToolbar_expandedSubtitleAppearance)) { mCollapsingTextHelper.setExpandedSubAppearance( mStyle.getResourceId(R.styleable.SubtitleCollapsingToolbar_expandedSubtitleAppearance, 0)); } // end // First load the default text appearances mCollapsingTextHelper.setExpandedTextAppearance(R.style.TextAppearance_Design_CollapsingToolbar_Expanded); mCollapsingTextHelper.setCollapsedTextAppearance( android.support.v7.appcompat.R.style.TextAppearance_AppCompat_Widget_ActionBar_Title); // Now overlay any custom text appearances if (a.hasValue(R.styleable.CollapsingToolbarLayout_expandedTitleTextAppearance)) { mCollapsingTextHelper.setExpandedTextAppearance( a.getResourceId(R.styleable.CollapsingToolbarLayout_expandedTitleTextAppearance, 0)); } if (a.hasValue(R.styleable.CollapsingToolbarLayout_collapsedTitleTextAppearance)) { mCollapsingTextHelper.setCollapsedTextAppearance( a.getResourceId(R.styleable.CollapsingToolbarLayout_collapsedTitleTextAppearance, 0)); } mScrimVisibleHeightTrigger = a .getDimensionPixelSize(R.styleable.CollapsingToolbarLayout_scrimVisibleHeightTrigger, -1); mScrimAnimationDuration = a.getInt(R.styleable.CollapsingToolbarLayout_scrimAnimationDuration, DEFAULT_SCRIM_ANIMATION_DURATION); setContentScrim(a.getDrawable(R.styleable.CollapsingToolbarLayout_contentScrim)); setStatusBarScrim(a.getDrawable(R.styleable.CollapsingToolbarLayout_statusBarScrim)); mToolbarId = a.getResourceId(R.styleable.CollapsingToolbarLayout_toolbarId, -1); a.recycle(); setWillNotDraw(false); ViewCompat.setOnApplyWindowInsetsListener(this, new android.support.v4.view.OnApplyWindowInsetsListener() { @Override public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets) { return onWindowInsetChanged(insets); } }); }
From source file:com.android.launcher3.BubbleTextView.java
public BubbleTextView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); mLauncher = Launcher.getLauncher(context); DeviceProfile grid = mLauncher.getDeviceProfile(); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.BubbleTextView, defStyle, 0); mCustomShadowsEnabled = a.getBoolean(R.styleable.BubbleTextView_customShadows, true); mLayoutHorizontal = a.getBoolean(R.styleable.BubbleTextView_layoutHorizontal, false); mDeferShadowGenerationOnTouch = a.getBoolean(R.styleable.BubbleTextView_deferShadowGeneration, false); int display = a.getInteger(R.styleable.BubbleTextView_iconDisplay, DISPLAY_WORKSPACE); int defaultIconSize = grid.iconSizePx; if (display == DISPLAY_WORKSPACE) { setTextSize(TypedValue.COMPLEX_UNIT_PX, grid.iconTextSizePx); } else if (display == DISPLAY_ALL_APPS) { setTextSize(TypedValue.COMPLEX_UNIT_PX, grid.allAppsIconTextSizePx); setCompoundDrawablePadding(grid.allAppsIconDrawablePaddingPx); defaultIconSize = grid.allAppsIconSizePx; } else if (display == DISPLAY_FOLDER) { setCompoundDrawablePadding(grid.folderChildDrawablePaddingPx); }//w w w . j av a 2 s. c om mCenterVertically = a.getBoolean(R.styleable.BubbleTextView_centerVertically, false); if (Utilities.getIconSizePrefEnabled(context) == -1) { mIconSize = a.getDimensionPixelSize(R.styleable.BubbleTextView_iconSizeOverride, defaultIconSize); Utilities.setIconSizeValue(context, mIconSize); a.recycle(); } else { mIconSize = Utilities.getIconSizePrefEnabled(context); } if (mCustomShadowsEnabled) { // Draw the background itself as the parent is drawn twice. mBackground = getBackground(); setBackground(null); // Set shadow layer as the larger shadow to that the textView does not clip the shadow. float density = getResources().getDisplayMetrics().density; setShadowLayer(density * AMBIENT_SHADOW_RADIUS, 0, 0, AMBIENT_SHADOW_COLOR); } else { mBackground = null; } mLongPressHelper = new CheckLongPressHelper(this); mStylusEventHelper = new StylusEventHelper(new SimpleOnStylusPressListener(this), this); mOutlineHelper = HolographicOutlineHelper.obtain(getContext()); setAccessibilityDelegate(mLauncher.getAccessibilityDelegate()); }
From source file:com.android.slidingmenu.HorizontalListView.java
/** * Parse the XML configuration for this widget * /*from w w w. j a va2 s. co m*/ * @param context * Context used for extracting attributes * @param attrs * The Attribute Set containing the ColumnView attributes */ private void retrieveXmlConfiguration(Context context, AttributeSet attrs) { if (attrs != null) { TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.HorizontalListView); // Get the provided drawable from the XML final Drawable d = a.getDrawable(R.styleable.HorizontalListView_android_divider); if (d != null) { // If a drawable is provided to use as the divider then use its // intrinsic width for the divider width setDivider(d); } // If a width is explicitly specified then use that width final int dividerWidth = a.getDimensionPixelSize(R.styleable.HorizontalListView_dividerWidth, 0); if (dividerWidth != 0) { setDividerWidth(dividerWidth); } a.recycle(); } }
From source file:com.jzg.jzgcarsource.view.HorizontalListView.java
/** * Parse the XML configuration for this widget * /*from w ww.ja v a 2 s. c o m*/ * @param context * Context used for extracting attributes * @param attrs * The Attribute Set containing the ColumnView attributes */ private void retrieveXmlConfiguration(Context context, AttributeSet attrs) { if (attrs != null) { TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.HorizontalListView); // Get the provided drawable from the XML final Drawable d = a.getDrawable(R.styleable.HorizontalListView_android_divider); if (d != null) { // If a drawable is provided to use as the divider then use its // intrinsic width for the divider width setDivider(d); } // If a width is explicitly specified then use that width final int dividerWidth = a.getDimensionPixelSize(R.styleable.HorizontalListView_dividerWidth1, 0); if (dividerWidth != 0) { setDividerWidth(dividerWidth); } a.recycle(); } }
From source file:com.android.launcher2.PagedView.java
public PagedView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PagedView, defStyle, 0); setPageSpacing(a.getDimensionPixelSize(R.styleable.PagedView_pageSpacing, 0)); mPageLayoutPaddingTop = a.getDimensionPixelSize(R.styleable.PagedView_pageLayoutPaddingTop, 0); mPageLayoutPaddingBottom = a.getDimensionPixelSize(R.styleable.PagedView_pageLayoutPaddingBottom, 0); mPageLayoutPaddingLeft = a.getDimensionPixelSize(R.styleable.PagedView_pageLayoutPaddingLeft, 0); mPageLayoutPaddingRight = a.getDimensionPixelSize(R.styleable.PagedView_pageLayoutPaddingRight, 0); mPageLayoutWidthGap = a.getDimensionPixelSize(R.styleable.PagedView_pageLayoutWidthGap, 0); mPageLayoutHeightGap = a.getDimensionPixelSize(R.styleable.PagedView_pageLayoutHeightGap, 0); mScrollIndicatorPaddingLeft = a.getDimensionPixelSize(R.styleable.PagedView_scrollIndicatorPaddingLeft, 0); mScrollIndicatorPaddingRight = a.getDimensionPixelSize(R.styleable.PagedView_scrollIndicatorPaddingRight, 0);/*w w w. ja v a 2 s. co m*/ a.recycle(); setHapticFeedbackEnabled(false); init(); }
From source file:com.jjoe64.graphview.GridLabelRenderer.java
/** * resets the styles. This loads the style * from reading the values of the current * theme.//from ww w. j a va 2 s . co m */ public void resetStyles() { // get matching styles from theme TypedValue typedValue = new TypedValue(); mGraphView.getContext().getTheme().resolveAttribute(android.R.attr.textAppearanceSmall, typedValue, true); int color1; int color2; int size; int size2; TypedArray array = null; try { array = mGraphView.getContext().obtainStyledAttributes(typedValue.data, new int[] { android.R.attr.textColorPrimary, android.R.attr.textColorSecondary, android.R.attr.textSize, android.R.attr.horizontalGap }); color1 = array.getColor(0, Color.BLACK); color2 = array.getColor(1, Color.GRAY); size = array.getDimensionPixelSize(2, 20); size2 = array.getDimensionPixelSize(3, 20); array.recycle(); } catch (Exception e) { color1 = Color.BLACK; color2 = Color.GRAY; size = 20; size2 = 20; } mStyles.verticalLabelsColor = color1; mStyles.verticalLabelsSecondScaleColor = color1; mStyles.horizontalLabelsColor = color1; mStyles.gridColor = color2; mStyles.textSize = size; mStyles.padding = size2; mStyles.labelsSpace = (int) mStyles.textSize / 5; mStyles.verticalLabelsAlign = Paint.Align.RIGHT; mStyles.verticalLabelsSecondScaleAlign = Paint.Align.LEFT; mStyles.highlightZeroLines = true; mStyles.verticalAxisTitleColor = mStyles.verticalLabelsColor; mStyles.horizontalAxisTitleColor = mStyles.horizontalLabelsColor; mStyles.verticalAxisTitleTextSize = mStyles.textSize; mStyles.horizontalAxisTitleTextSize = mStyles.textSize; mStyles.horizontalLabelsVisible = true; mStyles.verticalLabelsVisible = true; mStyles.horizontalLabelsAngle = 0f; mStyles.gridStyle = GridStyle.BOTH; reloadStyles(); }
From source file:com.doubleTwist.drawerlib.ADrawerLayout.java
public ADrawerLayout(Context ctx, AttributeSet attrs, int defStyle) { super(ctx, attrs, defStyle); ViewConfiguration vc = ViewConfiguration.get(ctx); mTouchSlop = vc.getScaledTouchSlop(); mVelocityTracker = VelocityTracker.obtain(); // Read the attributes passed in the XML view declaration TypedArray a = ctx.obtainStyledAttributes(attrs, R.styleable.ADrawerLayout); try {/*from ww w . j av a2 s . co m*/ Rect innerMargins = new Rect(); innerMargins.left = a.getDimensionPixelSize(R.styleable.ADrawerLayout_innerMarginLeft, 0); innerMargins.top = a.getDimensionPixelSize(R.styleable.ADrawerLayout_innerMarginTop, 0); innerMargins.right = a.getDimensionPixelSize(R.styleable.ADrawerLayout_innerMarginRight, 0); innerMargins.bottom = a.getDimensionPixelSize(R.styleable.ADrawerLayout_innerMarginBottom, 0); setInnerMargins(innerMargins); boolean innerIsGlobalLeft = a.getBoolean(R.styleable.ADrawerLayout_innerMarginIsGlobalLeft, false); boolean innerIsGlobalTop = a.getBoolean(R.styleable.ADrawerLayout_innerMarginIsGlobalTop, false); boolean innerIsGlobalRight = a.getBoolean(R.styleable.ADrawerLayout_innerMarginIsGlobalRight, false); boolean innerIsGlobalBottom = a.getBoolean(R.styleable.ADrawerLayout_innerMarginIsGlobalBottom, false); setInnerIsGlobal(innerIsGlobalLeft, innerIsGlobalTop, innerIsGlobalRight, innerIsGlobalBottom); Rect peekSize = new Rect(); peekSize.left = a.getDimensionPixelSize(R.styleable.ADrawerLayout_peekSizeLeft, 0); peekSize.top = a.getDimensionPixelSize(R.styleable.ADrawerLayout_peekSizeTop, 0); peekSize.right = a.getDimensionPixelSize(R.styleable.ADrawerLayout_peekSizeRight, 0); peekSize.bottom = a.getDimensionPixelSize(R.styleable.ADrawerLayout_peekSizeBottom, 0); setPeekSize(peekSize); boolean restrictToPeekLeft = a.getBoolean(R.styleable.ADrawerLayout_restrictToPeekLeft, true); boolean restrictToPeekTop = a.getBoolean(R.styleable.ADrawerLayout_restrictToPeekTop, true); boolean restrictToPeekRight = a.getBoolean(R.styleable.ADrawerLayout_restrictToPeekRight, true); boolean restrictToPeekBottom = a.getBoolean(R.styleable.ADrawerLayout_restrictToPeekBottom, true); setRestrictTouchesToPeekArea(restrictToPeekLeft, restrictToPeekTop, restrictToPeekRight, restrictToPeekBottom); } finally { a.recycle(); } }
From source file:com.android.contacts.list.ContactListItemView.java
public ContactListItemView(Context context, AttributeSet attrs) { super(context, attrs); TypedArray a; if (R.styleable.ContactListItemView != null) { // Read all style values a = getContext().obtainStyledAttributes(attrs, R.styleable.ContactListItemView); mPreferredHeight = a.getDimensionPixelSize(R.styleable.ContactListItemView_list_item_height, mPreferredHeight);/* w w w. j a va 2 s. co m*/ mActivatedBackgroundDrawable = a.getDrawable(R.styleable.ContactListItemView_activated_background); mGapBetweenImageAndText = a.getDimensionPixelOffset( R.styleable.ContactListItemView_list_item_gap_between_image_and_text, mGapBetweenImageAndText); mGapBetweenIndexerAndImage = a.getDimensionPixelOffset( R.styleable.ContactListItemView_list_item_gap_between_indexer_and_image, mGapBetweenIndexerAndImage); mGapBetweenLabelAndData = a.getDimensionPixelOffset( R.styleable.ContactListItemView_list_item_gap_between_label_and_data, mGapBetweenLabelAndData); mPresenceIconMargin = a.getDimensionPixelOffset( R.styleable.ContactListItemView_list_item_presence_icon_margin, mPresenceIconMargin); mPresenceIconSize = a.getDimensionPixelOffset( R.styleable.ContactListItemView_list_item_presence_icon_size, mPresenceIconSize); mDefaultPhotoViewSize = a.getDimensionPixelOffset(R.styleable.ContactListItemView_list_item_photo_size, mDefaultPhotoViewSize); mTextIndent = a.getDimensionPixelOffset(R.styleable.ContactListItemView_list_item_text_indent, mTextIndent); mTextOffsetTop = a.getDimensionPixelOffset(R.styleable.ContactListItemView_list_item_text_offset_top, mTextOffsetTop); mAvatarOffsetTop = a.getDimensionPixelOffset( R.styleable.ContactListItemView_list_item_avatar_offset_top, mAvatarOffsetTop); mDataViewWidthWeight = a.getInteger(R.styleable.ContactListItemView_list_item_data_width_weight, mDataViewWidthWeight); mLabelViewWidthWeight = a.getInteger(R.styleable.ContactListItemView_list_item_label_width_weight, mLabelViewWidthWeight); mNameTextViewTextColor = a.getColor(R.styleable.ContactListItemView_list_item_name_text_color, mNameTextViewTextColor); mNameTextViewTextSize = (int) a.getDimension(R.styleable.ContactListItemView_list_item_name_text_size, (int) getResources().getDimension(R.dimen.contact_browser_list_item_text_size)); mVideoCallIconSize = a.getDimensionPixelOffset( R.styleable.ContactListItemView_list_item_video_call_icon_size, mVideoCallIconSize); mVideoCallIconMargin = a.getDimensionPixelOffset( R.styleable.ContactListItemView_list_item_video_call_icon_margin, mVideoCallIconMargin); setPaddingRelative(a.getDimensionPixelOffset(R.styleable.ContactListItemView_list_item_padding_left, 0), a.getDimensionPixelOffset(R.styleable.ContactListItemView_list_item_padding_top, 0), a.getDimensionPixelOffset(R.styleable.ContactListItemView_list_item_padding_right, 0), a.getDimensionPixelOffset(R.styleable.ContactListItemView_list_item_padding_bottom, 0)); a.recycle(); } mTextHighlighter = new TextHighlighter(Typeface.BOLD); if (R.styleable.Theme != null) { a = getContext().obtainStyledAttributes(R.styleable.Theme); mSecondaryTextColor = a.getColorStateList(R.styleable.Theme_android_textColorSecondary); a.recycle(); } mHeaderWidth = getResources().getDimensionPixelSize(R.dimen.contact_list_section_header_width); if (mActivatedBackgroundDrawable != null) { mActivatedBackgroundDrawable.setCallback(this); } mNameHighlightSequence = new ArrayList<HighlightSequence>(); mNumberHighlightSequence = new ArrayList<HighlightSequence>(); setLayoutDirection(View.LAYOUT_DIRECTION_LOCALE); }
From source file:android.support.design.widget.AppBarLayout.java
public AppBarLayout(Context context, AttributeSet attrs) { super(context, attrs); setOrientation(VERTICAL);// w w w . j av a 2 s .co m ThemeUtils.checkAppCompatTheme(context); if (Build.VERSION.SDK_INT >= 21) { // Use the bounds view outline provider so that we cast a shadow, even without a // background ViewUtilsLollipop.setBoundsViewOutlineProvider(this); // If we're running on API 21+, we should reset any state list animator from our // default style ViewUtilsLollipop.setStateListAnimatorFromAttrs(this, attrs, 0, R.style.Widget_Design_AppBarLayout); } final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.AppBarLayout, 0, R.style.Widget_Design_AppBarLayout); ViewCompat.setBackground(this, a.getDrawable(R.styleable.AppBarLayout_android_background)); if (a.hasValue(R.styleable.AppBarLayout_expanded)) { setExpanded(a.getBoolean(R.styleable.AppBarLayout_expanded, false), false, false); } if (Build.VERSION.SDK_INT >= 21 && a.hasValue(R.styleable.AppBarLayout_elevation)) { ViewUtilsLollipop.setDefaultAppBarLayoutStateListAnimator(this, a.getDimensionPixelSize(R.styleable.AppBarLayout_elevation, 0)); } a.recycle(); ViewCompat.setOnApplyWindowInsetsListener(this, new android.support.v4.view.OnApplyWindowInsetsListener() { @Override public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets) { return onWindowInsetChanged(insets); } }); }