diff --git a/qmui/src/main/java/com/qmuiteam/qmui/widget/QMUIViewPager.java b/qmui/src/main/java/com/qmuiteam/qmui/widget/QMUIViewPager.java index cab1dd81d..d440ba723 100644 --- a/qmui/src/main/java/com/qmuiteam/qmui/widget/QMUIViewPager.java +++ b/qmui/src/main/java/com/qmuiteam/qmui/widget/QMUIViewPager.java @@ -1,19 +1,17 @@ package com.qmuiteam.qmui.widget; -import android.annotation.TargetApi; import android.content.Context; import android.database.DataSetObserver; import android.graphics.Rect; import android.os.Build; import android.os.Parcelable; import android.support.v4.view.PagerAdapter; +import android.support.v4.view.ViewCompat; import android.support.v4.view.ViewPager; -import android.support.v4.view.WindowInsetsCompat; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; -import android.view.WindowInsets; import com.qmuiteam.qmui.util.QMUIWindowInsetHelper; @@ -66,6 +64,12 @@ public void setEnableLoop(boolean enableLoop) { } + @Override + public void addView(View child, int index, ViewGroup.LayoutParams params) { + super.addView(child, index, params); + ViewCompat.requestApplyInsets(this); + } + @Override public boolean onTouchEvent(MotionEvent ev) { return mIsSwipeable && super.onTouchEvent(ev);