国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統(tǒng) > iOS > 正文

android仿ios彈性頁

2019-11-11 04:45:55
字體:
供稿:網(wǎng)友
public class Drag extends LinearLayout {    PRivate ViewDragHelper mDraw;    private Point mPoint = new Point();    public Drag(Context context, AttributeSet attrs) {        super(context, attrs);        mDraw = ViewDragHelper.create(this, 1.0f, new ViewDragHelper.Callback() {            @Override            public boolean tryCaptureView(View child, int pointerId) {                return true;            }            @Override            public int clampViewPositionHorizontal(View child, int left, int dx) {                int boundaryLeft = getPaddingLeft();                int boundaryRight = getWidth() - child.getWidth() - getPaddingRight();                left = Math.min(Math.max(left, boundaryLeft), boundaryRight);                return left;            }            @Override            public int clampViewPositionVertical(View child, int top, int dy) {                Log.e("zxc", "top-------->" + top);                //垂直下拉彈性                if (top == 0) {                    top = 0;                }                if (top > 300) {                    top = 300;                }              //垂直上拉彈性                if (top < 0){                    if (top < -300){                        top = -300;                    }                }                return top;            }            //手指釋放的時候回調(diào)            @Override            public void onViewReleased(View releasedChild, float xvel, float yvel) {                mDraw.settleCapturedViewAt(0,0);                invalidate();            }        });    }    @Override    public void computeScroll()    {        if(mDraw.continueSettling(true))        {            invalidate();        }    }    @Override    protected void onLayout(boolean changed, int l, int t, int r, int b) {        super.onLayout(changed, l, t, r, b);    }    @Override    public boolean onInterceptTouchEvent(MotionEvent ev) {        return mDraw.shouldInterceptTouchEvent(ev);    }    @Override    public boolean onTouchEvent(MotionEvent event) {        mDraw.processTouchEvent(event);        return true;    }}
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 张家界市| 武陟县| 长海县| 山丹县| 绥化市| 慈利县| 合水县| 资溪县| 陵川县| 龙门县| 福贡县| 山阳县| 庄浪县| 兴文县| 柘荣县| 静乐县| 石林| 津市市| 青川县| 二连浩特市| 万安县| 古交市| 山丹县| 通渭县| 蕲春县| 广西| 龙门县| 乐业县| 邢台市| 蒲江县| 论坛| 台安县| 娄烦县| 大城县| 宜兴市| 长治市| 重庆市| 化州市| 慈溪市| 探索| 桃源县|