帮酷LOGO
0 0 评论
  • 显示原文与译文双语对照的内容
支持多種顯示效果與無限滾動的RecyclerView

  • 源代碼名稱:CircleRecyclerView
  • 源代碼網址:http://www.github.com/kHRYSTAL/CircleRecyclerView
  • CircleRecyclerView源代碼文檔
  • CircleRecyclerView源代碼下載
  • Git URL:
    git://www.github.com/kHRYSTAL/CircleRecyclerView.git
  • Git Clone代碼到本地:
    git clone http://www.github.com/kHRYSTAL/CircleRecyclerView
  • Subversion代碼到本地:
    $ svn co --depth empty http://www.github.com/kHRYSTAL/CircleRecyclerView
    Checked out revision 1.
    $ cd repo
    $ svn up trunk
    
  • CircleRecyclerView

    the library is a loop RecyclerView, can show some effects when display

    screenshot

    CircularViewMode

    CircularViewMode

    ScaleXViewMode & ScaleYViewMode

    ScaleXYViewMode

    RotateXScaleYViewMode & RotateYScaleXViewMode

    RotateXYScaleXYViewMode

    NoLoop but CenterForce (setClipPadding(l,t,r,b); setClipChildren(false);)

    CircularHorizontalMode

    CircularHorizontalMode

    usage

    
    
    
    mCircleRecyclerView = (CircleRecyclerView) view.findViewById(R.id.circle_rv);
    
    
    mCircleRecyclerView.setLayoutManager(mLayoutManager);
    
    
    mCircleRecyclerView.setViewMode(mItemViewMode); // T implements ItemViewMode, after setLayoutManager(manager)
    
    
    mCircleRecyclerView.setNeedCenterForce(true); // when SCROLL_STATE_IDLE == state, nearly center itemview scroll to center
    
    
    
    mCircleRecyclerView.setNeedLoop(true); // default is true
    
    
    
    // if setCenterForce(true), can set this callback
    
    
    mCircleRecyclerView.setOnCenterItemClickListener(new CircleRecyclerView.OnCenterItemClickListener() {
    
    
        @Override
    
    
        public void onCenterItemClick(View v) {
    
    
            Toast.makeText(getContext(), "Center Clicked", Toast.LENGTH_SHORT).show();
    
    
        }
    
    
    });
    
    
    
    

    and if loop is true, the RecyclerView.Adapter need like this:

    @Override
    
    
    public void onBindViewHolder(VH holder, int position) {
    
    
        positionData = mDataList.get(position % mDataList.size());
    
    
    }
    
    
    
    @Override
    
    
    public int getItemCount() {
    
    
        return Integer.MAX_VALUE;
    
    
    }
    
    
    
    



    Copyright © 2011 HelpLib All rights reserved.    知识分享协议 京ICP备05059198号-3  |  如果智培  |  酷兔英语