Giter Site home page Giter Site logo

vegalayoutmanager's Introduction

VegaLayoutManager

a customized LayoutManager - fade and shrink the head itemView when scrolling.

实现效果

Dribbble设计:链接
IOS实现:VegaScroll

代码思路

RecyclerView最顶部的itemView,会随着手指滑动实现收缩隐藏与放大显示,并伴随recycler的回收与复用。

代码比较简单粗暴,使用自定义的LayoutManger,内置SnapHelper。
由于想要在任意时刻都能snap到第一个子View,所以在LayoutManager中用了比较讨巧的方法去设定scroll的最大值。

使用方法

  1. gradle引入
compile 'com.stone.vega.library:VegaLayoutManager:1.0.6'
  1. java文件中设定LayoutManager
recyclerView.setLayoutManager(new VegaLayoutManager());

demo下载

点击下载

License

Copyright 2017, xmuSistone

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

vegalayoutmanager's People

Contributors

hirayclay avatar xmusistone avatar xngpro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vegalayoutmanager's Issues

關於setDarkMode()

2017-09-29_141425

2017-09-29_141627

開啟2的方式, 是要先透過1
然後2會接受到傳過來的 darkMode參數為true
既然darkMode參數 恆為true, 3的部分 還有需要判斷嗎?

還是說有其它原因?

detachAndScrapAttachedViews()

2017-10-01_195417

2017-10-01_195659

想請教一下
detachAndScrapAttachedViews(recycler), 究竟是只有把第一個View放進緩存, 還是把所有的View 都放進緩存?

How to stop auto scroll item?

Thanks for this library.

I want to use the same animation as the library have but I just need to remove code which is for auto scroll when the first position hide. I need behavior same like the normal recycled view. can you please guild me how can I stop auto-scroll when move position?

Thanks

Not able to search for recyclerView items

Hi, assume that you have a RecyclerView containing 100 items inside it.
Each list item has TextViews and you want to make a search with a help of EditText.

When the list has first loaded with containing 100 items and you made a search, you don't see any problem and you can make a achieved search.

But when you scroll the list to the bottom and make for a item which is collapsed by another item(am in it is the main feature VegaLayoutManager) search doesn't show list items. (Search process is succeed but view's does not appear.

I appreciate for any useful information. Thanks for great job !

child view visibility

changing visibility of specific View (view inside viewItem ) at some position than view height does not change. its height stays same.

recyclew+viewpager显示异常

设置了viewpager的高度和id之后,前几个viewpager可以正常显示,滑动后下方的viewpager不显示,点击不显示的viewpager之后又正常显示了。

how to snap it to next item only like viewpager

i need a solution for the snap helper , right now it scrolls and snaps to the position , but i want it like viewpager snaping to the next position even i fling it

something like Paging your RecyclerView

Not visible any view on VegaLayoutManager

i am using VegaLayoutManager , but screen is blank(nothing showing) !

RecyclerView recyclerView = (RecyclerView) findViewById(R.id.main_recycler_view);
recyclerView.setLayoutManager(new VegaLayoutManager());
adapter = getAdapter();
recyclerView.setAdapter(adapter);

not working for me ! any idea how to fix it?

demo显示无内容

把demo下载来运行,结果什么都不展示。把recyclerView.setLayoutManager(new VegaLayoutManager());换成recyclerView.setLayoutManager(new LinearLayoutManager(this));有内容,但是没有了效果

Different behaviour On Different OS

Its the same issue as issue21.I am adding it cause the issue was not resolved previously. Before i have tested it on kitkat and above . Now its showing the kitkat like behavior on Android N too. I have tested on MOTO Z play.

On kitkat/Android N - On scroll to bottom, the last items scrolls to the top .
Above Kitkat - The last item remains on the bottom of recycler view .

Can it be resolve? or its OS dependent .
Thx
Diaz

多餘的

2017-09-28_202349

紅框內的代碼, 似乎是多餘的, 有或者沒有 都不會影響到畫面呈現的效果
還是我哪裡 理解錯了?

Fragment中使用什么都不展示

recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); 有效果recyclerView.setLayoutManager(new VegaLayoutManager());不显示

Problems with space between items.

Hello, thanks for this spectacular library.

I have a problem with my RecyclerView: the linear layout manager works fine but as soon as I try yours, I have this problem (Photos: https://photos.app.goo.gl/KB84ASKxTwdrZkVH2 )

Is there a way to fix it?

As you can see, there is A LOT of space between some items and the last doesn't have the little textview in the bottom of the card.

Thanks

View scaling improperly

When we attach it a card with different height then its causing view scaling issue. View are cropped.

送给有需要的人

本来想看源码学习的,看着好多代码,累了,就想着自己弄,
看了看效果,感觉就是线性的,唯一的区别就是第一个item有个变化而已。
代码如下,继承LinearLayoutManager重写如下的方法即可,基本可以达到效果,好像有人想要横向的,逻辑也差不多。

` var oldChild0:View?=null;
override fun scrollVerticallyBy(dy: Int, recycler: RecyclerView.Recycler, state: RecyclerView.State?): Int {
val result=super.scrollVerticallyBy(dy, recycler, state)
if(childCount>1){
val child1=getChildAt(1)
val child0=getChildAt(0)
if(oldChild0!=null&&oldChild0!=child0){
resetChild(oldChild0!!)
}
oldChild0=child0
var scale=0.7f+0.3f*(child1.top)/getDecoratedMeasuredHeight(child1)

        child0.pivotX=child0.width/2f
        child0.pivotY=child0.height/1f
        child0.scaleX=scale
        child0.scaleY=scale
        child0.translationY=getDecoratedMeasuredHeight(child1)-child1.top.toFloat()
        child0.alpha=scale
        if(scale<0.7){
            resetChild(child0)
            removeAndRecycleView(child0,recycler)
        }
    }
    return  result
}
private fun resetChild(child:View){
    child.apply {
        pivotY=this.width/2f
        pivotX=this.height/1f
        scaleX=1f;
        scaleY=1f;
        alpha=1f;
        translationY=0f
    }
}

`

Different behaviour On Kitkat and above Kikat

I have tested VegaLayoutManager in Kitkat and above . There is a behavior difference .

On kitkat - On scroll to bottom, the last items scrolls to the top .
Above Kitkat - The last item remains on the bottom of recycler view .

Is this the issue with RecyclerView in Kitkat or some other ?

RecyclerView as Viewpager with PagerSnapHelper

I have used recyclerview as vertical viewpager with the help of PagerSnapHelper. Only one item at a time will be displayed. When I scroll , it should display previous/next item . How can I use this layoutmanager for my recyclerview. Please help me!!! Thanks in advance

gradle 引入有问题

gradle引入:compile 'com.stone.vega.library:VegaLayoutManager:1.0.6'

报错信息为:
Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.stone.vega.library:VegaLayoutManager:1.0.6.
Open File
Show Details

Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.stone.vega.library:VegaLayoutManager:1.0.6.
Open File
Show Details

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.