androidx.core.widget.NestedScrollView类的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(173)

本文整理了Java中androidx.core.widget.NestedScrollView类的一些代码示例,展示了NestedScrollView类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。NestedScrollView类的具体详情如下:
包路径:androidx.core.widget.NestedScrollView
类名称:NestedScrollView

NestedScrollView介绍

暂无

代码示例

代码示例来源:origin: h6ah4i/android-advancedrecyclerview

private void handleScrollOnDraggingInternalWithNestedScrollView(RecyclerView rv, boolean horizontal) {
  NestedScrollView nestedScrollView = mNestedScrollView;
  int nestedScrollViewScrollOffsetX = nestedScrollView.getScrollX();
  int nestedScrollViewScrollOffsetY = nestedScrollView.getScrollY();
  int nestedScrollViewTouchY = rect.top - nestedScrollViewScrollOffsetY;
  final int edge = (horizontal) ? nestedScrollView.getWidth() : nestedScrollView.getHeight();
  final float invEdge = (1.0f / edge);
  final float normalizedTouchPos = (horizontal ? nestedScrollViewTouchX : nestedScrollViewTouchY) * invEdge;
      nestedScrollView.scrollBy(scrollAmount, 0);
    } else {
      nestedScrollView.scrollBy(0, scrollAmount);

代码示例来源:origin: h6ah4i/android-advancedrecyclerview

private void handleActionMoveWhileDragging(RecyclerView rv, MotionEvent e) {
  mLastTouchX = (int) (e.getX() + 0.5f);
  mLastTouchY = (int) (e.getY() + 0.5f);
  mNestedScrollViewScrollX = (mNestedScrollView != null) ? mNestedScrollView.getScrollX() : 0;
  mNestedScrollViewScrollY = (mNestedScrollView != null) ? mNestedScrollView.getScrollY() : 0;
  mDragMinTouchX = Math.min(mDragMinTouchX, mLastTouchX);
  mDragMinTouchY = Math.min(mDragMinTouchY, mLastTouchY);
  mDragMaxTouchX = Math.max(mDragMaxTouchX, mLastTouchX);
  mDragMaxTouchY = Math.max(mDragMaxTouchY, mLastTouchY);
  // update drag direction mask
  updateDragDirectionMask();
  // update decorators
  final boolean updated = mDraggingItemDecorator.update(getLastTouchX(), getLastTouchY(), false);
  if (updated) {
    if (mSwapTargetItemOperator != null) {
      mSwapTargetItemOperator.update(mDraggingItemDecorator.getDraggingItemTranslationX(), mDraggingItemDecorator.getDraggingItemTranslationY());
    }
    // check swapping
    checkItemSwapping(rv);
    onItemMoveDistanceUpdated();
  }
}

代码示例来源:origin: florent37/ViewTooltip

private ViewTooltip(MyContext myContext, View rootView, View view) {
  this.rootView = rootView;
  this.view = view;
  this.tooltip_view = new TooltipView(myContext.getContext());
  final NestedScrollView scrollParent = findScrollParent(view);
  if (scrollParent != null) {
    scrollParent.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() {
      @Override
      public void onScrollChange(NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
        tooltip_view.setTranslationY(tooltip_view.getTranslationY() - (scrollY - oldScrollY));
      }
    });
  }
}

代码示例来源:origin: jruesga/rview

mBinding.nestedScroll.fullScroll(View.FOCUS_DOWN);
  mBinding.fastScroller.hide();
});
mBinding.nestedScroll.setOnScrollChangeListener(
  (NestedScrollView.OnScrollChangeListener)
      (v, scrollX, scrollY, oldScrollX, oldScrollY) -> {
    float h = mBinding.nestedScroll.getHeight();
    float h14 = h / 4;
    float mt = mBinding.messageInfo.getRoot().getTop();

代码示例来源:origin: pranavpandey/dynamic-support

mScrollView.setOnScrollChangeListener(
      new NestedScrollView.OnScrollChangeListener() {
        @Override
  mScrollView.post(new Runnable() {
    @Override
    public void run() {
} else if (mViewRoot != null) {
  if (mViewRoot instanceof NestedScrollView) {
    ((NestedScrollView) mViewRoot).setOnScrollChangeListener(
        new NestedScrollView.OnScrollChangeListener() {
          @Override

代码示例来源:origin: h6ah4i/android-advancedrecyclerview

private int getLastTouchY() {
  int touchY = mLastTouchY;
  if (mNestedScrollView != null) {
    touchY += (mNestedScrollView.getScrollY() - mNestedScrollViewScrollY);
  }
  return touchY;
}

代码示例来源:origin: florent37/ExpansionPanel

@Override
public void addView(View child, ViewGroup.LayoutParams params) {
  if (getChildCount() > 0) {
    throw new IllegalStateException("ExpansionLayout can host only one direct child");
  }
  super.addView(child, params);
  onViewAdded();
}

代码示例来源:origin: pranavpandey/dynamic-support

private void setupContent(ViewGroup contentPanel) {
  mScrollView = mWindow.findViewById(R.id.scrollView);
  mScrollView.setFocusable(false);
  ViewCompat.setNestedScrollingEnabled(mScrollView, false);
  // Special case for users that only want to display a String
  mMessageView = contentPanel.findViewById(android.R.id.message);
  if (mMessageView == null) {
    return;
  }
  if (mMessage != null) {
    mMessageView.setText(mMessage);
  } else {
    mMessageView.setVisibility(View.GONE);
    mScrollView.removeView(mMessageView);
    if (mListView != null) {
      final ViewGroup scrollParent = (ViewGroup) mScrollView.getParent();
      final int childIndex = scrollParent.indexOfChild(mScrollView);
      scrollParent.removeViewAt(childIndex);
      scrollParent.addView(mListView, childIndex,
          new ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT));
    } else {
      // contentPanel.setVisibility(View.GONE);
    }
  }
}

代码示例来源:origin: bkhezry/ExtraWebView

private void setFullscreen(boolean isFullscreen) {
  if (!getUserVisibleHint()) {
    return;
  }
  mFullscreen = isFullscreen;
  mControls.setVisibility(isFullscreen ? VISIBLE : View.GONE);
  AppUtils.toggleWebViewZoom(mWebView.getSettings(), isFullscreen);
  if (isFullscreen) {
    mScrollView.removeView(mScrollViewContent);
    mFullscreenView.addView(mScrollViewContent);
  } else {
    reset();
    mWebView.pageUp(true);
    mFullscreenView.removeView(mScrollViewContent);
    mScrollView.addView(mScrollViewContent);
  }
}

代码示例来源:origin: AlexMofer/ProjectX

@Override
public void onLayoutChange(View v, int left, int top, int right, int bottom,
              int oldLeft, int oldTop, int oldRight, int oldBottom) {
  mVContent.fullScroll(View.FOCUS_DOWN);
}

代码示例来源:origin: pranavpandey/dynamic-support

@Override
protected void onOverScrolled(int scrollX, int scrollY, boolean clampedX, boolean clampedY) {
  super.scrollTo(scrollX, scrollY);
  setColor();
}

代码示例来源:origin: h6ah4i/android-advancedrecyclerview

private int getLastTouchX() {
  int touchX = mLastTouchX;
  if (mNestedScrollView != null) {
    touchX += (mNestedScrollView.getScrollX() - mNestedScrollViewScrollX);
  }
  return touchX;
}

代码示例来源:origin: h6ah4i/android-advancedrecyclerview

mLastTouchY = (int) (e.getY() + 0.5f);
mNestedScrollViewScrollX = (mNestedScrollView != null) ? mNestedScrollView.getScrollX() : 0;
mNestedScrollViewScrollY = (mNestedScrollView != null) ? mNestedScrollView.getScrollY() : 0;

代码示例来源:origin: florent37/ViewTooltip

private ViewTooltip(MyContext myContext, View view) {
  this.view = view;
  this.tooltip_view = new TooltipView(myContext.getContext());
  final NestedScrollView scrollParent = findScrollParent(view);
  if (scrollParent != null) {
    scrollParent.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() {
      @Override
      public void onScrollChange(NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
        tooltip_view.setTranslationY(tooltip_view.getTranslationY() - (scrollY - oldScrollY));
      }
    });
  }
}

代码示例来源:origin: klinker24/Android-DragDismissActivity

@Override
  public void run() {
    if (!transparentBackground && scrollView.getScrollY() < topOffset && !isUpdatingBackground) {
      animateBackgroundColor(primaryColor, transparentColor, interpolator);
      transparentBackground = true;
    }
  }
}, ANIMATION_DURATION);

代码示例来源:origin: florent37/ExpansionPanel

@Override
public void addView(View child) {
  if (getChildCount() > 0) {
    throw new IllegalStateException("ExpansionLayout can host only one direct child");
  }
  super.addView(child);
  onViewAdded();
}

代码示例来源:origin: jruesga/rview

private void addPendingAttachments(Attachment attachment) {
  ModelHelper.addAttachment(attachment, mAttachments);
  updateReviewInfo(mResponse);
  mUiHandler.post(() -> mBinding.nestedScroll.fullScroll(View.FOCUS_DOWN));
}

代码示例来源:origin: proninyaroslav/libretorrent

@Override
public void onViewStateRestored(@Nullable Bundle savedInstanceState)
{
  super.onViewStateRestored(savedInstanceState);
  if (savedInstanceState != null) {
    scrollPosition = savedInstanceState.getIntArray(TAG_SCROLL_POSITION);
    if (scrollPosition != null && scrollPosition.length == 2)
      pieceMapScrollView.scrollTo(scrollPosition[0], scrollPosition[1]);
  }
}

代码示例来源:origin: proninyaroslav/libretorrent

@Override
public void onSaveInstanceState(@NonNull Bundle outState)
{
  super.onSaveInstanceState(outState);
  outState.putInt(TAG_ALL_PIECES_COUNT, allPiecesCount);
  outState.putInt(TAG_PIECE_SIZE, pieceSize);
  outState.putInt(TAG_DOWNLOADED_PIECES, downloadedPieces);
  if (pieceMapScrollView != null && scrollPosition != null) {
    scrollPosition[0] = pieceMapScrollView.getScrollX();
    scrollPosition[1] = pieceMapScrollView.getScrollY();
    outState.putIntArray(TAG_SCROLL_POSITION, scrollPosition);
  }
  Bundle b = new Bundle();
  b.putBooleanArray(TAG_PIECES, pieces);
  HeavyInstanceStorage storage = HeavyInstanceStorage.getInstance(getFragmentManager());
  if (storage != null)
    storage.pushData(HEAVY_STATE_TAG, b);
}

代码示例来源:origin: pranavpandey/dynamic-support

((NestedScrollView) mViewRoot).setOnScrollChangeListener(
    new NestedScrollView.OnScrollChangeListener() {
      @Override

相关文章