滾動到底部
// 滾動到底 if (scrolly == (v.getchildat(0).getmeasuredheight() - v.getmeasuredheight()))
滾動到頂
if (scrolly == 0)
完整**如下:
svscrollouter.setonscrollchangelistener(new nestedscrollview.onscrollchangelistener()
if (scrolly < oldscrolly)
if (scrolly == 0)
// 滾動到底
if (scrolly == (v.getchildat(0).getmeasuredheight() - v.getmeasuredheight()))
//判斷某個控制項是否可見
rect scrollbounds = new rect();
svscrollouter.gethitrect(scrollbounds);
if (tvscrollthree.getlocalvisiblerect(scrollbounds)) else
// log.e(tag, "onscrollchange: ------------" + scrolly +"------"+ tvscrollthree.gettop() );
// //判斷某個控制項是否滾到頂部
// if (scrolly == tvscrollthree.gettop())
//// log.e(tag, "onscrollchange: bottmo" + scrolly +"-----"+ (tvscrollthree.gettop() + tvscrollthree.getheight()) );
}});
複製**
svscrollouter.fullscroll(nestedscrollview.focus_down);
複製**
svscrollouter.fullscroll(nestedscrollview.focus_up);
複製**
//頂部
svscrollouter.scrollto(0,tvscrollfour.gettop());
//底部
svscrollouter.scrollto(0,tvscrollthree.getbottom());
複製**
//判斷某個控制項是否可見
rect scrollbounds = new rect();
svscrollouter.gethitrect(scrollbounds);
if (tvscrollthree.getlocalvisiblerect(scrollbounds)) else
複製**
帶有滾動監聽的ScrollView
package com.util.listenedscrollview import android.content.context import android.os.handler import android.os.message import android.util.attributese...
監聽ScrollView滑動方向
其實android的view類裡面有乙個方法 protected void onscrollchanged int l,intt,int oldl,int oldt 通過查詢資料發現可以重寫這個方法來監聽列表的滑動方向。下面我給出我針對scrollview實現的監聽類。可以監聽scrollview的...
scrollview監聽滑動位置
android監聽scrollview滑動到頂端和底部 packagecn.testscrollview importandroid.os.bundle importandroid.view.motionevent importandroid.view.view importandroid.view...