More Related Content
Similar to Material Designなdrawerを実装したい (20)
More from shinya sakemoto (14)
Material Designなdrawerを実装したい
- 23. FrameLayoutを拡張したカスタムレイアウト
ScrimInsetsFrameLayout (by iosched)
ScrimInsetsFrameLayoutGoogle Play
private void init(Context context, AttributeSet attrs, int defStyle) {
final TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.ScrimInsetsView, defStyle, 0);
if (a == null) {
return;
}
mInsetForeground = a.getDrawable(R.styleable.ScrimInsetsView_insetForeground);
a.recycle();
setWillNotDraw(true);
}
@Override
protected boolean fitSystemWindows(Rect insets) {
mInsets = new Rect(insets);
setWillNotDraw(mInsetForeground == null);
ViewCompat.postInvalidateOnAnimation(this);
if (mOnInsetsCallback != null) {
mOnInsetsCallback.onInsetsChanged(insets);
}
return true; // consume insets
}