SwipeView类似桌面的滑动界面(10)
来源:未知 责任编辑:责任编辑 发表时间:2013-12-06 08:44 点击:次
{
float xDistance = Math.abs(mMotionStartX - ev.getX());
float yDistance = Math.abs(mMotionStartY - ev.getY());
if(yDistance>xDistance+5)
{
mMostlyScrollingInY = true;
}
else if(xDistance>yDistance+5)
{
mMostlyScrollingInX = true;
}
}
}
private class SwipeOnTouchListener implements View.OnTouchListener
{
private boolean mSendingDummyMotionEvent = false;
private int mDistanceX;
private int mPreviousDirection;
private boolean mFirstMotionEvent = true;
public boolean onTouch(View v, MotionEvent event)
{
if(mOnTouchListener!=null && !mJustInterceptedAndIgnored || mOnTouchListener!=null && mSendingDummyMotionEvent) //send on touch event to onTouchListener set by an application implementing a SwipeView and setting their own onTouchListener
{
if(mOnTouchListener.onTouch(v, event))
{
if(event.getAction() == MotionEvent.ACTION_UP) //this comes back if a very quick movement event has happened over a view with an onClick
{
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>