本文整理匯總了Java中android.support.v7.widget.RecyclerView.computeVerticalScrollRange方法的典型用法代碼示例。如果您正苦於以下問題:Java RecyclerView.computeVerticalScrollRange方法的具體用法?Java RecyclerView.computeVerticalScrollRange怎麽用?Java RecyclerView.computeVerticalScrollRange使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.v7.widget.RecyclerView
的用法示例。
在下文中一共展示了RecyclerView.computeVerticalScrollRange方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: fireScrollEvent
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
private void fireScrollEvent(RecyclerView recyclerView, int offsetX, int offsetY) {
int contentWidth = recyclerView.getMeasuredWidth() + recyclerView.computeHorizontalScrollRange();
int contentHeight = recyclerView.computeVerticalScrollRange();
Map<String, Object> event = new HashMap<>(2);
Map<String, Object> contentSize = new HashMap<>(2);
Map<String, Object> contentOffset = new HashMap<>(2);
contentSize.put(Constants.Name.WIDTH, WXViewUtils.getWebPxByWidth(contentWidth, getInstance().getInstanceViewPortWidth()));
contentSize.put(Constants.Name.HEIGHT, WXViewUtils.getWebPxByWidth(contentHeight, getInstance().getInstanceViewPortWidth()));
contentOffset.put(Constants.Name.X, - WXViewUtils.getWebPxByWidth(offsetX, getInstance().getInstanceViewPortWidth()));
contentOffset.put(Constants.Name.Y, - WXViewUtils.getWebPxByWidth(offsetY, getInstance().getInstanceViewPortWidth()));
event.put(Constants.Name.CONTENT_SIZE, contentSize);
event.put(Constants.Name.CONTENT_OFFSET, contentOffset);
fireEvent(Constants.Event.SCROLL, event);
}
示例2: onScrolled
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
if (bubble == null || handle.isSelected())
return;
int verticalScrollOffset = recyclerView.computeVerticalScrollOffset();
int verticalScrollRange = recyclerView.computeVerticalScrollRange();
float proportion = (float) verticalScrollOffset / ((float) verticalScrollRange - height);
setBubbleAndHandlePosition(height * proportion);
}
示例3: isSlideToBottom
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
/**
* 判斷是否到底部了
* @param recyclerView
* @return
*/
protected boolean isSlideToBottom(RecyclerView recyclerView) {
if (recyclerView == null) return false;
if(mOrientation == LinearLayoutManager.VERTICAL) {
if (recyclerView.computeVerticalScrollExtent() + recyclerView.computeVerticalScrollOffset() >= recyclerView.computeVerticalScrollRange())
return true;
}
else
{
if (recyclerView.computeHorizontalScrollExtent() + recyclerView.computeHorizontalScrollOffset() >= recyclerView.computeHorizontalScrollRange())
return true;
}
return false;
}
示例4: onScrolled
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
public void onScrolled(final RecyclerView recyclerView, final int dx, final int dy) {
if (handle.isSelected()) return;
final int offset = recyclerView.computeVerticalScrollOffset();
final int range = recyclerView.computeVerticalScrollRange();
final int extent = recyclerView.computeVerticalScrollExtent();
final int offsetRange = Math.max(range - extent, 1);
setBubbleAndHandlePosition((float) Util.clamp(offset, 0, offsetRange) / offsetRange);
}
示例5: isMaxScrollReached
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
static private boolean isMaxScrollReached(RecyclerView recyclerView) {
int maxScroll = recyclerView.computeVerticalScrollRange();
int currentScroll = recyclerView.computeVerticalScrollOffset() + recyclerView.computeVerticalScrollExtent();
android.util.Log.d(TAG, maxScroll + ", " + currentScroll);
if (maxScroll == 0)
return false;
return currentScroll >= maxScroll;
}
示例6: rvPullUpIntercept
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
public boolean rvPullUpIntercept(View child) {
boolean intercept = false;
RecyclerView recyclerChild = (RecyclerView) child;
if (recyclerChild.computeVerticalScrollExtent() + recyclerChild.computeVerticalScrollOffset()
>= recyclerChild.computeVerticalScrollRange())
intercept = true;
return intercept;
}
示例7: onScrolled
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
if (scrollerView.isSelected()) return;
int verticalScrollOffset = recyclerView.computeVerticalScrollOffset();
int verticalScrollRange = recyclerView.computeVerticalScrollRange();
float proportion = (float) verticalScrollOffset / ((float) verticalScrollRange - height);
setScrollerHeight(height * proportion);
}