Android 自定义ScrollView 支持惯性滑动,惯性回弹效果。支持上拉加载更多
先讲下原理:
ScrollView的子View 主要分为3部分:head头部,滚动内容,fooder底部
我们实现惯性滑动,以及回弹,都是靠超过head或者fooder 就重新滚动到 ,内容的顶部或者底部。
之前看了Pulltorefresh 他是通过不断改变 head或者 fooder的 pading 值来实现 上拉或者 下拉的效果。感觉有点不流畅,而且层次嵌套得比较多。当然他的好处是扩展性好。
因工作需求,需要层次嵌套少,对性能要求非常高。因此重新自定义了ViewGroup实现。
直接上代码:
- package com.example.administrator.customscrollview;
- import android.content.Context;
- import android.content.res.TypedArray;
- import android.util.AttributeSet;
- import android.util.Log;
- import android.view.Gravity;
- import android.view.MotionEvent;
- import android.view.VelocityTracker;
- import android.view.View;
- import android.view.ViewConfiguration;
- import android.view.ViewGroup;
- import android.widget.OverScroller;
- /**
- * 自定义 pulltorefresh Layout
- * TODO: ferris 2015年9月11日 18:52:40
- */
- public class PullTorefreshScrollView extends ViewGroup {
- private FoodeLayout fooder_layout;// top and buttom
- private View top_layout;
- private int desireWidth, desireHeight;
- private VelocityTracker velocityTracker;
- private int mPointerId;
- private float x, y;
- private OverScroller mScroller;
- private int maxFlingVelocity, minFlingVelocity;
- private int mTouchSlop;
- protected Boolean isMove = false;
- protected float downX = 0, downY = 0;
- private int top_hight = 0;
- private int scrollYButtom = 0;
- private int nScrollYButtom = 0;
- private int pullDownMin = 0;
- private Boolean isEnablePullDown = true;
- private Boolean isFirst=true;
- public void setEnablePullDown(Boolean isEnablePullDown) {
- this.isEnablePullDown = isEnablePullDown;
- }
- public PullTorefreshScrollView(Context context) {
- super(context);
- init(null, 0);
- }
- public PullTorefreshScrollView(Context context, AttributeSet attrs) {
- super(context, attrs);
- init(attrs, 0);
- }
- public PullTorefreshScrollView(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- init(attrs, defStyle);
- }
- private void init(AttributeSet attrs, int defStyle) {
- // Load attributes
- // final TypedArray a = getContext().obtainStyledAttributes(
- // attrs, R.styleable.PullTorefreshScrollView, defStyle, 0);
- //
- //
- // a.recycle();
- mScroller = new OverScroller(getContext());
- maxFlingVelocity = ViewConfiguration.get(getContext()).getScaledMaximumFlingVelocity();
- minFlingVelocity = ViewConfiguration.get(getContext()).getScaledMinimumFlingVelocity();
- mTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
- }
- @Override
- protected void onFinishInflate() {
- super.onFinishInflate();
- fooder_layout = (FoodeLayout) findViewById(R.id.fooder_layout);
- top_layout = findViewById(R.id.top_layout);
- if (isEnablePullDown) {
- fooder_layout.showFooderPull();
- } else {
- fooder_layout.hideFooder();
- }
- }
- public int getScrollYTop() {
- return top_hight;
- }
- public int getScrollYButtom() {
- return scrollYButtom;
- }
- public int getNScrollYTop() {
- return 0;
- }
- public int getNScrollYButtom() {
- return nScrollYButtom;
- }
- public int measureWidth(int widthMeasureSpec) {
- int result = 0;
- int measureMode = MeasureSpec.getMode(widthMeasureSpec);
- int width = MeasureSpec.getSize(widthMeasureSpec);
- switch (measureMode) {
- case MeasureSpec.AT_MOST:
- case MeasureSpec.EXACTLY:
- result = width;
- break;
- default:
- break;
- }
- return result;
- }
- public int measureHeight(int heightMeasureSpec) {
- int result = 0;
- int measureMode = MeasureSpec.getMode(heightMeasureSpec);
- int height = MeasureSpec.getSize(heightMeasureSpec);
- switch (measureMode) {
- case MeasureSpec.AT_MOST:
- case MeasureSpec.EXACTLY:
- result = height;
- break;
- default:
- break;
- }
- return result;
- }
- @Override
- protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- // 计算所有child view 要占用的空间
- int width = measureWidth(widthMeasureSpec);
- int height = measureHeight(heightMeasureSpec);
- desireWidth = 0;
- desireHeight = 0;
- int count = getChildCount();
- for (int i = 0; i < count; ++i) {
- View v = getChildAt(i);
- if (v.getVisibility() != View.GONE) {
- LayoutParams lp = (LayoutParams) v.getLayoutParams();
- measureChildWithMargins(v, widthMeasureSpec, 0,
- heightMeasureSpec, 0);
- //只是在这里增加了垂直或者水平方向的判断
- if (v.getId() == R.id.top_layout) {
- top_hight = v.getMeasuredHeight();
- }
- desireWidth = Math.max(desireWidth, v.getMeasuredWidth()
- + lp.leftMargin + lp.rightMargin);
- desireHeight += v.getMeasuredHeight() + lp.topMargin
- + lp.bottomMargin;
- }
- }
- // count with padding
- desireWidth += getPaddingLeft() + getPaddingRight();
- desireHeight += getPaddingTop() + getPaddingBottom();
- // see if the size is big enough
- desireWidth = Math.max(desireWidth, getSuggestedMinimumWidth());
- desireHeight = Math.max(desireHeight, getSuggestedMinimumHeight());
- //处理内容比较少的时候,就添加一定的高度
- int scrollHight = height + top_hight * 2;
- if (scrollHight > desireWidth) {
- int offset = scrollHight - desireHeight;
- View view = new View(getContext());
- view.setBackgroundResource(R.color.top_layout_color);
- LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, offset);
- addView(view, getChildCount() - 1, lp);
- desireWidth = scrollHight;
- }
- setMeasuredDimension(resolveSize(desireWidth, widthMeasureSpec),
- resolveSize(desireHeight, heightMeasureSpec));
- scrollYButtom = desireHeight - getMeasuredHeight() - top_hight;
- nScrollYButtom = desireHeight - getMeasuredHeight();
- //如果上啦拖出一半的高度,就代表将要执行上啦
- pullDownMin = nScrollYButtom - top_hight / 2;
- if(isFirst){
- scrollTo(0, top_hight);
- isFirst=false;
- }
- }
- @Override
- protected void onLayout(boolean changed, int l, int t, int r, int b) {
- final int parentLeft = getPaddingLeft();
- final int parentRight = r - l - getPaddingRight();
- final int parentTop = getPaddingTop();
- final int parentBottom = b - t - getPaddingBottom();
- if (BuildConfig.DEBUG)
- Log.d("onlayout", "parentleft: " + parentLeft + " parenttop: "
- + parentTop + " parentright: " + parentRight
- + " parentbottom: " + parentBottom);
- int left = parentLeft;
- int top = parentTop;
- int count = getChildCount();
- for (int i = 0; i < count; ++i) {
- View v = getChildAt(i);
- if (v.getVisibility() != View.GONE) {
- LayoutParams lp = (LayoutParams) v.getLayoutParams();
- final int childWidth = v.getMeasuredWidth();
- final int childHeight = v.getMeasuredHeight();
- final int gravity = lp.gravity;
- final int horizontalGravity = gravity
- & Gravity.HORIZONTAL_GRAVITY_MASK;
- final int verticalGravity = gravity
- & Gravity.VERTICAL_GRAVITY_MASK;
- // layout vertical, and only consider horizontal gravity
- left = parentLeft;
- top += lp.topMargin;
- switch (horizontalGravity) {
- case Gravity.LEFT:
- break;
- case Gravity.CENTER_HORIZONTAL:
- left = parentLeft
- + (parentRight - parentLeft - childWidth) / 2
- + lp.leftMargin - lp.rightMargin;
- break;
- case Gravity.RIGHT:
- left = parentRight - childWidth - lp.rightMargin;
- break;
- }
- v.layout(left, top, left + childWidth, top + childHeight);
- top += childHeight + lp.bottomMargin;
- }
- }
- }
- @Override
- protected android.view.ViewGroup.LayoutParams generateDefaultLayoutParams() {
- return new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
- ViewGroup.LayoutParams.MATCH_PARENT);
- }
- @Override
- public android.view.ViewGroup.LayoutParams generateLayoutParams(
- AttributeSet attrs) {
- return new LayoutParams(getContext(), attrs);
- }
- @Override
- protected android.view.ViewGroup.LayoutParams generateLayoutParams(
- android.view.ViewGroup.LayoutParams p) {
- return new LayoutParams(p);
- }
- public static class LayoutParams extends MarginLayoutParams {
- public int gravity = -1;
- public LayoutParams(Context c, AttributeSet attrs) {
- super(c, attrs);
- TypedArray ta = c.obtainStyledAttributes(attrs,
- R.styleable.SlideGroup);
- gravity = ta.getInt(R.styleable.SlideGroup_layout_gravity, -1);
- ta.recycle();
- }
- public LayoutParams(int width, int height) {
- this(width, height, -1);
- }
- public LayoutParams(int width, int height, int gravity) {
- super(width, height);
- this.gravity = gravity;
- }
- public LayoutParams(android.view.ViewGroup.LayoutParams source) {
- super(source);
- }
- public LayoutParams(MarginLayoutParams source) {
- super(source);
- }
- }
- /**
- * onInterceptTouchEvent()用来询问是否要拦截处理。 onTouchEvent()是用来进行处理。
- * <p/>
- * 例如:parentLayout----childLayout----childView 事件的分发流程:
- * parentLayout::onInterceptTouchEvent()---false?--->
- * childLayout::onInterceptTouchEvent()---false?--->
- * childView::onTouchEvent()---false?--->
- * childLayout::onTouchEvent()---false?---> parentLayout::onTouchEvent()
- * <p/>
- * <p/>
- * <p/>
- * 如果onInterceptTouchEvent()返回false,且分发的子View的onTouchEvent()中返回true,
- * 那么onInterceptTouchEvent()将收到所有的后续事件。
- * <p/>
- * 如果onInterceptTouchEvent()返回true,原本的target将收到ACTION_CANCEL,该事件
- * 将会发送给我们自己的onTouchEvent()。
- */
- @Override
- public boolean onInterceptTouchEvent(MotionEvent ev) {
- final int action = ev.getActionMasked();
- if (BuildConfig.DEBUG)
- Log.d("onInterceptTouchEvent", "action: " + action);
- if (action == MotionEvent.ACTION_DOWN && ev.getEdgeFlags() != 0) {
- // 该事件可能不是我们的
- return false;
- }
- boolean isIntercept = false;
- switch (action) {
- case MotionEvent.ACTION_DOWN:
- // 如果动画还未结束,则将此事件交给onTouchEvet()处理,
- // 否则,先分发给子View
- isIntercept = !mScroller.isFinished();
- // 如果此时不拦截ACTION_DOWN时间,应该记录下触摸地址及手指id,当我们决定拦截ACTION_MOVE的event时,
- // 将会需要这些初始信息(因为我们的onTouchEvent将可能接收不到ACTION_DOWN事件)
- mPointerId = ev.getPointerId(0);
- // if (!isIntercept) {
- downX = x = ev.getX();
- downY = y = ev.getY();
- // }
- break;
- case MotionEvent.ACTION_MOVE:
- int pointerIndex = ev.findPointerIndex(mPointerId);
- if (BuildConfig.DEBUG)
- Log.d("onInterceptTouchEvent", "pointerIndex: " + pointerIndex
- + ", pointerId: " + mPointerId);
- float mx = ev.getX(pointerIndex);
- float my = ev.getY(pointerIndex);
- if (BuildConfig.DEBUG)
- Log.d("onInterceptTouchEvent", "action_move [touchSlop: "
- + mTouchSlop + ", deltaX: " + (x - mx) + ", deltaY: "
- + (y - my) + "]");
- // 根据方向进行拦截,(其实这样,如果我们的方向是水平的,里面有一个ScrollView,那么我们是支持嵌套的)
- if (Math.abs(y - my) >= mTouchSlop) {
- isIntercept = true;
- }
- //如果不拦截的话,我们不会更新位置,这样可以通过累积小的移动距离来判断是否达到可以认为是Move的阈值。
- //这里当产生拦截的话,会更新位置(这样相当于损失了mTouchSlop的移动距离,如果不更新,可能会有一点点跳的感觉)
- if (isIntercept) {
- x = mx;
- y = my;
- }
- break;
- case MotionEvent.ACTION_CANCEL:
- case MotionEvent.ACTION_UP:
- // 这是触摸的最后一个事件,无论如何都不会拦截
- if (velocityTracker != null) {
- velocityTracker.recycle();
- velocityTracker = null;
- }
- break;
- case MotionEvent.ACTION_POINTER_UP:
- solvePointerUp(ev);
- break;
- }
- return isIntercept;
- }
- private void solvePointerUp(MotionEvent event) {
- // 获取离开屏幕的手指的索引
- int pointerIndexLeave = event.getActionIndex();
- int pointerIdLeave = event.getPointerId(pointerIndexLeave);
- if (mPointerId == pointerIdLeave) {
- // 离开屏幕的正是目前的有效手指,此处需要重新调整,并且需要重置VelocityTracker
- int reIndex = pointerIndexLeave == 0 ? 1 : 0;
- mPointerId = event.getPointerId(reIndex);
- // 调整触摸位置,防止出现跳动
- x = event.getX(reIndex);
- y = event.getY(reIndex);
- if (velocityTracker != null)
- velocityTracker.clear();
- }
- }
- @Override
- public boolean onTouchEvent(MotionEvent event) {
- final int action = event.getActionMasked();
- if (velocityTracker == null) {
- velocityTracker = VelocityTracker.obtain();
- }
- velocityTracker.addMovement(event);
- switch (action) {
- case MotionEvent.ACTION_DOWN:
- // 获取索引为0的手指id
- isMove = false;
- mPointerId = event.getPointerId(0);
- x = event.getX();
- y = event.getY();
- if (!mScroller.isFinished())
- mScroller.abortAnimation();
- break;
- case MotionEvent.ACTION_MOVE:
- isMove = true;
- // 获取当前手指id所对应的索引,虽然在ACTION_DOWN的时候,我们默认选取索引为0
- // 的手指,但当有第二个手指触摸,并且先前有效的手指up之后,我们会调整有效手指
- // 屏幕上可能有多个手指,我们需要保证使用的是同一个手指的移动轨迹,
- // 因此此处不能使用event.getActionIndex()来获得索引
- final int pointerIndex = event.findPointerIndex(mPointerId);
- float mx = event.getX(pointerIndex);
- float my = event.getY(pointerIndex);
- moveBy((int) (x - mx), (int) (y - my));
- x = mx;
- y = my;
- break;
- case MotionEvent.ACTION_UP:
- isMove = false;
- velocityTracker.computeCurrentVelocity(1000, maxFlingVelocity);
- float velocityX = velocityTracker.getXVelocity(mPointerId);
- float velocityY = velocityTracker.getYVelocity(mPointerId);
- completeMove(-velocityX, -velocityY);
- if (velocityTracker != null) {
- velocityTracker.recycle();
- velocityTracker = null;
- }
- break;
- case MotionEvent.ACTION_POINTER_UP:
- // 获取离开屏幕的手指的索引
- isMove = false;
- int pointerIndexLeave = event.getActionIndex();
- int pointerIdLeave = event.getPointerId(pointerIndexLeave);
- if (mPointerId == pointerIdLeave) {
- // 离开屏幕的正是目前的有效手指,此处需要重新调整,并且需要重置VelocityTracker
- int reIndex = pointerIndexLeave == 0 ? 1 : 0;
- mPointerId = event.getPointerId(reIndex);
- // 调整触摸位置,防止出现跳动
- x = event.getX(reIndex);
- y = event.getY(reIndex);
- if (velocityTracker != null)
- velocityTracker.clear();
- }
- break;
- case MotionEvent.ACTION_CANCEL:
- isMove = false;
- break;
- }
- return true;
- }
- private Boolean isPull = false;
- //此处的moveBy是根据水平或是垂直排放的方向,
- //来选择是水平移动还是垂直移动
- public void moveBy(int deltaX, int deltaY) {
- if (BuildConfig.DEBUG)
- Log.d("moveBy", "deltaX: " + deltaX + " deltaY: " + deltaY);
- if (Math.abs(deltaY) >= Math.abs(deltaX)) {
- int mScrollY = getScrollY();
- if (mScrollY <= 0) {
- scrollTo(0, 0);
- } else if (mScrollY >= getNScrollYButtom()) {
- scrollTo(0, getNScrollYButtom());
- } else {
- scrollBy(0, deltaY);
- }
- if (isEnablePullDown && deltaY > 0 && mScrollY >= pullDownMin) {
- isPull = true;
- Log.d("onlayout", "isPull: true");
- }
- }
- }
- private void completeMove(float velocityX, float velocityY) {
- int mScrollY = getScrollY();
- int maxY = getScrollYButtom();
- int minY = getScrollYTop();
- if (mScrollY >= maxY) {//如果滚动,超过了 下边界,就回弹到下边界
- if (isPull) {//滚动到最底部
- mScroller.startScroll(0, mScrollY, 0, getNScrollYButtom() - mScrollY, 300);
- invalidate();
- //显示雷达
- fooder_layout.showFooderRadar();
- if (pullDownListem != null) {
- pullDownListem.onPullDown();
- }
- Log.d("onlayout", "isPull: true 滚动到最底部,显示出雷达");
- } else {
- mScroller.startScroll(0, mScrollY, 0, maxY - mScrollY);
- invalidate();
- Log.d("onlayout", "isPull: true");
- }
- } else if (mScrollY <= minY) {//如果滚动,超过了上边界,就回弹到上边界
- // 超出了上边界,弹回
- mScroller.startScroll(0, mScrollY, 0, minY - mScrollY);
- invalidate();
- } else if (Math.abs(velocityY) >= minFlingVelocity && maxY > 0) {//大于1页的时候
- // mScroller.fling(0, mScrollY, 0, (int) (velocityY * 1.2f), 0, 0, minY, maxY);
- mScroller.fling(0, mScrollY, 0, (int) (velocityY * 2f), 0, 0, getNScrollYTop(), getNScrollYButtom());
- invalidate();
- }
- }
- public void ifNeedScrollBack() {
- int mScrollY = getScrollY();
- int maxY = getScrollYButtom();
- int minY = getScrollYTop();
- if (mScrollY > maxY) {
- // 超出了下边界,弹回
- mScroller.startScroll(0, mScrollY, 0, maxY - mScrollY);
- invalidate();
- } else if (mScrollY < minY) {
- // 超出了上边界,弹回
- mScroller.startScroll(0, mScrollY, 0, minY - mScrollY);
- invalidate();
- }
- }
- @Override
- protected void onScrollChanged(int l, int t, int oldl, int oldt) {
- super.onScrollChanged(l, t, oldl, oldt);
- }
- @Override
- public void computeScroll() {
- if (mScroller.computeScrollOffset()) {
- scrollTo(0, mScroller.getCurrY());
- postInvalidate();
- } else {
- Log.d("onlayout", "computeScroll,isMove:"+isMove+",isPull:"+isPull);
- if (!isMove && !isPull) {
- ifNeedScrollBack();
- }
- }
- }
- public void onPullSuccess() {
- soomToBack();
- }
- public void soomToBack() {
- int mScrollY = getScrollY();
- int maxY = getScrollYButtom();
- Log.d("onlayout", "soomToBack: (maxY - mScrollY)="+(maxY - mScrollY)+",maxY="+maxY+",mScrollY="+mScrollY);
- // 超出了下边界,弹回
- mScroller.startScroll(0, mScrollY, 0, maxY - mScrollY, 300);
- invalidate();
- postDelayed(new Runnable() {
- @Override
- public void run() {
- fooder_layout.showFooderPull();
- isPull = false;
- }
- }, 310);
- }
- private PullDownListem pullDownListem;
- public void setPullDownListem(PullDownListem pullDownListem) {
- this.pullDownListem = pullDownListem;
- }
- public interface PullDownListem {
- public void onPullDown();
- }
- }
Android 自定义ScrollView 支持惯性滑动,惯性回弹效果。支持上拉加载更多的更多相关文章
- Android中自定义ListView实现上拉加载更多和下拉刷新
ListView是Android中一个功能强大而且很常用的控件,在很多App中都有ListView的下拉刷新数据和上拉加载更多这个功能.这里我就简单记录一下实现过程. 实现这个功能的方法不止一个,Gi ...
- YCRefreshView-自定义支持上拉加载更多,下拉刷新。。。
自定义支持上拉加载更多,下拉刷新,支持自由切换状态[加载中,加载成功,加载失败,没网络等状态]的控件,拓展功能[支持长按拖拽,侧滑删除]可以选择性添加 .具体使用方法,可以直接参考demo. 轻量级侧 ...
- Android 开发 上拉加载更多功能实现
实现思维 开始之前先废话几句,Android系统没有提供上拉加载的控件,只提供了下拉刷新的SwipeRefreshLayout控件.这个控件我们就不废话,无法实现上拉刷新的功能.现在我们说说上拉加载更 ...
- SwipeRefreshLayout详解和自定义上拉加载更多
个人主页 演示Demo下载 本文重点介绍了SwipeRefreshLayout的使用和自定View继承SwipeRefreshLayout添加上拉加载更多的功能. 介绍之前,先来看一下SwipeRef ...
- Android项目:使用pulltorefresh开源项目扩展为下拉刷新上拉加载更多的处理方法,监听listview滚动方向
很多android应用的下拉刷新都是使用的pulltorefresh这个开源项目,但是它的扩展性在下拉刷新同时又上拉加载更多时会有一定的局限性.查了很多地方,发现这个开源项目并不能很好的同时支持下拉刷 ...
- 自定义ListView下拉刷新上拉加载更多
自定义ListView下拉刷新上拉加载更多 自定义RecyclerView下拉刷新上拉加载更多 Listview现在用的很少了,基本都是使用Recycleview,但是不得不说Listview具有划时 ...
- android ListView下拉刷新 上拉加载更多
背景 最近在公司的项目中要使用到ListView的下拉刷新和上拉加载更多(貌似现在是个项目就有这个功能!哈哈),其实这个东西GitHub上很多,但是我感觉那些框架太大,而且我这个项目只用到了ListV ...
- android ListView上拉加载更多 下拉刷新功能实现(采用pull-to-refresh)
Android实现上拉加载更多功能以及下拉刷新功能, 采用了目前比较火的PullToRefresh,他是目前实现比较好的下拉刷新的类库. 目前他支持的控件有:ListView, ExpandableL ...
- google官方的下拉刷新+自定义上拉加载更多
转载请标注转载:http://blog.csdn.net/oqihaogongyuan/article/details/50949118 google官方的下拉刷新+自定义上拉加载更多 现在很多app ...
- react-native-page-listview使用方法(自定义FlatList/ListView下拉刷新,上拉加载更多,方便的实现分页)
react-native-page-listview 对ListView/FlatList的封装,可以很方便的分页加载网络数据,还支持自定义下拉刷新View和上拉加载更多的View.兼容高版本Flat ...
随机推荐
- 了解CentOS及周边
CentOS相关介绍 CentOS是Community ENTerprise Operating System的简称RHEL的全称则是Red Hat Enterprise LinuxFedoro Co ...
- meta是什么意思?
META标签,是HTML语言head区的一个辅助性标签.在几乎所有的page里,我们都可以看 到类似下面这段html代码: -------------------------------------- ...
- 【BZOJ1011】【HNOI2008】遥远的行星
奇奇怪怪突然出戏的奇葩题 原题: 直线上N颗行星,X=i处有行星i,行星J受到行星I的作用力,当且仅当i<=AJ.此时J受到作用力的大小为 Fi->j=Mi*Mj/(j-i) 其中A为很小 ...
- 【NOIP2014】飞扬的小鸟
看syq的代码写出来的,chty_orz 原题: Flappy Bird 是一款风靡一时的休闲手机游戏.玩家需要不断控制点击手机屏幕的频率来调节小鸟的飞行高度,让小鸟顺利通过画面右方的管道缝隙.如果小 ...
- ExtJS控件样式修改及美化
Extjs项目对富客户端开发提供了强有力的支持,甚至改变了前端的开发方式,使得开发变得更加趋向于“面向组件”.对界面的美化而言,也是根本性的改变.普通的网页美工面对extjs项目根本无法下手,需要脚本 ...
- 论文笔记之:Semi-Supervised Learning with Generative Adversarial Networks
Semi-Supervised Learning with Generative Adversarial Networks 引言:本文将产生式对抗网络(GAN)拓展到半监督学习,通过强制判别器来输出类 ...
- Awesome Deep Vision
Awesome Deep Vision A curated list of deep learning resources for computer vision, inspired by awes ...
- javascript实现prim算法
<script type="text/javascript"> //图的构建 function vnode() { this.visited = 0; this.ver ...
- C++仿函数和typename的用法
1.仿函数的定义是很简单的,就是一个重载了括号()运算符的类,也被称为函数对象. 主要是用于个性化扩展算法对象.stl中实现了好多算法,每个算法都可以完成日常的大部分工作,设计者还允许你在这些强大的算 ...
- IntelliJ IDEA currently
https://www.jetbrains.com/help/idea/2016.2/creating-a-project-from-scratch.html https://www.jetbrain ...