本文整理汇总了Java中android.support.v4.view.ScrollingView类的典型用法代码示例。如果您正苦于以下问题:Java ScrollingView类的具体用法?Java ScrollingView怎么用?Java ScrollingView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ScrollingView类属于android.support.v4.view包,在下文中一共展示了ScrollingView类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findScrollView
import android.support.v4.view.ScrollingView; //导入依赖的package包/类
/**
* Find out the scrollable child view from a ViewGroup.
*/
private void findScrollView(ViewGroup viewGroup) {
scrollChild = viewGroup;
if (viewGroup.getChildCount() > 0) {
int count = viewGroup.getChildCount();
View child;
for (int i = 0; i < count; i++) {
child = viewGroup.getChildAt(i);
if (child instanceof ScrollingView ||
child instanceof AbsListView ||
child instanceof ScrollView ||
child instanceof ViewPager ||
child instanceof WebView) {
scrollChild = child;
return;
}
}
}
}
示例2: findScrollableViewInternal
import android.support.v4.view.ScrollingView; //导入依赖的package包/类
protected View findScrollableViewInternal(View content, boolean selfable) {
View scrollableView = null;
Queue<View> views = new LinkedBlockingQueue<>(Collections.singletonList(content));
while (!views.isEmpty() && scrollableView == null) {
View view = views.poll();
if (view != null) {
if ((selfable || view != content) && (view instanceof AbsListView
|| view instanceof ScrollView
|| view instanceof ScrollingView
|| view instanceof NestedScrollingChild
|| view instanceof NestedScrollingParent
|| view instanceof WebView
|| view instanceof ViewPager)) {
scrollableView = view;
} else if (view instanceof ViewGroup) {
ViewGroup group = (ViewGroup) view;
for (int j = 0; j < group.getChildCount(); j++) {
views.add(group.getChildAt(j));
}
}
}
}
return scrollableView;
}
示例3: findScrollableViewInternal
import android.support.v4.view.ScrollingView; //导入依赖的package包/类
private View findScrollableViewInternal(View content, boolean selfable) {
View scrollableView = null;
Queue<View> views = new LinkedBlockingQueue<>(Collections.singletonList(content));
while (!views.isEmpty() && scrollableView == null) {
View view = views.poll();
if (view != null) {
if ((selfable || view != content) && (view instanceof AbsListView
|| view instanceof ScrollView
|| view instanceof ScrollingView
|| view instanceof NestedScrollingChild
|| view instanceof NestedScrollingParent
|| view instanceof WebView
|| view instanceof ViewPager)) {
scrollableView = view;
} else if (view instanceof ViewGroup) {
ViewGroup group = (ViewGroup) view;
for (int j = 0; j < group.getChildCount(); j++) {
views.add(group.getChildAt(j));
}
}
}
}
return scrollableView;
}
示例4: findOffset
import android.support.v4.view.ScrollingView; //导入依赖的package包/类
private void findOffset(ViewGroup root) {
for (int index = 0; index < root.getChildCount(); index++) {
View child = root.getChildAt(index);
if (child instanceof ScrollView || child instanceof ScrollingView || child instanceof AbsListView || child instanceof WebView) {
int widSpec = View.MeasureSpec.makeMeasureSpec(originalWidth, View.MeasureSpec.EXACTLY);
int heightSpec = View.MeasureSpec.makeMeasureSpec(BIG_ENOUGH_HEIGHT, View.MeasureSpec.AT_MOST);
child.measure(widSpec, heightSpec);
if (child.getMeasuredHeight() == BIG_ENOUGH_HEIGHT) {
heightSpec = View.MeasureSpec.makeMeasureSpec(BIG_ENOUGH_HEIGHT, View.MeasureSpec.UNSPECIFIED);
child.measure(widSpec, heightSpec);
}
updateOffset(child.getHeight(), child.getMeasuredHeight(), child);
} else if (child instanceof ZoomPanLayout) {
updateOffset(child.getHeight(), ((ZoomPanLayout) child).getScaledHeight(), child);
} else if (child instanceof ViewGroup) {
findOffset((ViewGroup) child);
}
}
}
示例5: isAlmostBottom
import android.support.v4.view.ScrollingView; //导入依赖的package包/类
/**
* @return {@code true} if child view almost scroll to bottom.
*/
public boolean isAlmostBottom() {
if (null == mTarget) {
return false;
}
if (mTarget instanceof AbsListView) {
final AbsListView absListView = (AbsListView) mTarget;
return absListView.getLastVisiblePosition() >= absListView.getCount() - 1;
} else if (mTarget instanceof ScrollingView) {
final ScrollingView scrollingView = (ScrollingView) mTarget;
final int offset = scrollingView.computeVerticalScrollOffset();
final int range = scrollingView.computeVerticalScrollRange() -
scrollingView.computeVerticalScrollExtent();
return offset >= range;
} else {
return !ViewCompat.canScrollVertically(mTarget, 1);
}
}
示例6: onNestedFling
import android.support.v4.view.ScrollingView; //导入依赖的package包/类
@Override
public boolean onNestedFling(final CoordinatorLayout coordinatorLayout, final AppBarLayout child, final View target,
final float velocityX, float velocityY, boolean consumed) {
if (velocityY > 0 && !isPositive || velocityY < 0 && isPositive) {
velocityY = velocityY * -1;
}
if (target instanceof SwipeRefreshLayout) {
consumed = consumed((SwipeRefreshLayout) target, consumed);
} else if (target instanceof RecyclerView) {
consumed = consumed((RecyclerView) target);
} else if (target instanceof ScrollingView) {
consumed = target.getScrollY() < 0;
}
return super.onNestedFling(coordinatorLayout, child, target, velocityX, velocityY, consumed);
}
示例7: inListView
import android.support.v4.view.ScrollingView; //导入依赖的package包/类
/**
* is video controllerView in 'list' controllerView
* @return
*/
public boolean inListView() {
for (ViewParent vp = getParent(); vp != null; vp = vp.getParent()) {
if (vp instanceof AbsListView || vp instanceof ScrollingView || vp instanceof ScrollView) {
return true;
}
}
return false;
}
示例8: isScrollableView
import android.support.v4.view.ScrollingView; //导入依赖的package包/类
protected boolean isScrollableView(View view) {
return view instanceof AbsListView
|| view instanceof ScrollView
|| view instanceof ScrollingView
|| view instanceof NestedScrollingChild
|| view instanceof NestedScrollingParent
|| view instanceof WebView
|| view instanceof ViewPager;
}
示例9: run
import android.support.v4.view.ScrollingView; //导入依赖的package包/类
@Override
public void run() {
if (mScroller.computeScrollOffset()) {
int dy = mScroller.getCurrY() - mLastFlingY;
final int selfOffset = getTopAndBottomOffset();
final int newSelfOffset = Math.max(mMinOffset, Math.min(mMaxOffset, selfOffset - dy));
final int skipped = newSelfOffset - selfOffset + dy;
final boolean selfFinished = !setTopAndBottomOffset(newSelfOffset);
final int targetOffset;
final boolean targetFinished;
if (mTargetView instanceof ScrollingView) {
targetOffset = ((ScrollingView) mTargetView).computeVerticalScrollOffset();
mTargetView.scrollBy(0, skipped);
targetFinished = (targetOffset == ((ScrollingView) mTargetView).computeVerticalScrollOffset());
} else {
targetOffset = mTargetView.getScrollY();
mTargetView.scrollBy(0, skipped);
targetFinished = (targetOffset == mTargetView.getScrollY());
}
final boolean scrollerFinished = mScroller.isFinished();
if (scrollerFinished || (selfFinished && targetFinished)) {
return;
}
mCoordinatorLayout.postOnAnimation(this);
mLastFlingY = mScroller.getCurrY();
}
}
示例10: consumed
import android.support.v4.view.ScrollingView; //导入依赖的package包/类
private boolean consumed(final SwipeRefreshLayout swipeRefreshLayout, final boolean defaultValue) {
if (swipeRefreshLayout.getChildCount() > 0) {
if (swipeRefreshLayout.getChildAt(0) instanceof RecyclerView) {
return consumed((RecyclerView) swipeRefreshLayout.getChildAt(0));
} else if (swipeRefreshLayout.getChildAt(0) instanceof ScrollingView) {
return swipeRefreshLayout.getScrollY() < 0;
}
}
return defaultValue;
}