2 listview的item全部漏出才显示

 1 lvMaster.setOnScrollListener(new ScrollListener() {
 2             @Override
 3             public void onScrollStateChanged(AbsListView absListView, int i) {
 4                 super.onScrollStateChanged(absListView, i);
 5             }
 6 
 7             @Override
 8             public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
 9                 super.onScroll(absListView, firstVisibleItem, visibleItemCount, totalItemCount);
10                 View animView;
11                 for (int i = 0; i < visibleItemCount; i++) {
12                     animView = lvMaster.getListView().getChildAt(i);
13                     if (animView == null) {
14                         continue;
15                     }
16                     if (getScroll(lvMaster.getListView()) <= 0 && visibleItemCount == 1) {
17                         ViewHelper.setAlpha(animView, 1f);
18                     } else {
19                         if(animView.getBottom()<=lvMaster.getListView().getBottom()){
20                             ViewHelper.setAlpha(animView, 1f);
21                         }
22                         else {
23                             ViewHelper.setAlpha(animView, 0f);
24                         }
25                     }
26                 }
27             }
28         });
滑动事件
1 protected int getScroll(ListView listview) {
2         int scrollY = 0;
3         View c =  listview.getChildAt(0); //this is the first visible row
4         if(c != null){
5             scrollY = -c.getTop(); 
6        return scrollY;
7     }
8 }
getScroll

 

posted @ 2016-04-08 09:34  YyuTtian  阅读(167)  评论(0编辑  收藏  举报