diff --git a/demo/src/main/res/layout/listview_item.xml b/demo/src/main/res/layout/listview_item.xml index 54cc383..db12e97 100644 --- a/demo/src/main/res/layout/listview_item.xml +++ b/demo/src/main/res/layout/listview_item.xml @@ -3,9 +3,11 @@ android:layout_width="match_parent" android:layout_height="match_parent"> mSwipeListeners = new ArrayList(); private List mSwipeDeniers = new ArrayList(); private Map> mRevealListeners = new HashMap>(); @@ -65,6 +68,8 @@ public class SwipeLayout extends FrameLayout { TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SwipeLayout); int ordinal = a.getInt(R.styleable.SwipeLayout_drag_edge, DragEdge.Right.ordinal()); + mHorizontalSwipeOffset =a.getDimension(R.styleable.SwipeLayout_horizontalSwipeOffset,0); + mVerticalSwipeOffset =a.getDimension(R.styleable.SwipeLayout_verticalSwipeOffset,0); mDragEdge = DragEdge.values()[ordinal]; ordinal = a.getInt(R.styleable.SwipeLayout_show_mode, ShowMode.PullOut.ordinal()); mShowMode = ShowMode.values()[ordinal]; @@ -657,9 +662,9 @@ public class SwipeLayout extends FrameLayout { super.onMeasure(widthMeasureSpec, heightMeasureSpec); if(mDragEdge == DragEdge.Left || mDragEdge == DragEdge.Right) - mDragDistance = getBottomView().getMeasuredWidth(); + mDragDistance = getBottomView().getMeasuredWidth()-dp2px(mHorizontalSwipeOffset); else - mDragDistance = getBottomView().getMeasuredHeight(); + mDragDistance = getBottomView().getMeasuredHeight()-dp2px(mVerticalSwipeOffset); } private boolean mTouchConsumedByChild = false; diff --git a/library/src/main/res/values/attrs.xml b/library/src/main/res/values/attrs.xml index c574ff7..9f69031 100644 --- a/library/src/main/res/values/attrs.xml +++ b/library/src/main/res/values/attrs.xml @@ -7,6 +7,8 @@ + +