下面列出了androidx.recyclerview.widget.RecyclerView#setOverScrollMode ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Nullable
@Override
protected View onCreateContentView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
RecyclerView recyclerView = new RecyclerView(requireContext());
recyclerView.setOverScrollMode(RecyclerView.OVER_SCROLL_NEVER);
return recyclerView;
}
@Override
protected void onContentViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onContentViewCreated(view, savedInstanceState);
setTitle(mParams.title);
getPositiveButton().setVisibility(View.GONE);
getNegativeButton().setOnClickListener(v -> dismiss());
RecyclerView recyclerView = (RecyclerView) view;
recyclerView.setOverScrollMode(RecyclerView.OVER_SCROLL_NEVER);
recyclerView.setLayoutManager(new LinearLayoutManager(requireContext()));
recyclerView.setAdapter(new ItemsAdapter());
revealBottomSheet();
}
@Nullable
@Override
protected View onCreateContentView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
RecyclerView recyclerView = new RecyclerView(requireContext());
recyclerView.setOverScrollMode(RecyclerView.OVER_SCROLL_NEVER);
return recyclerView;
}
@OnMount
static void onMount(
ComponentContext c,
SectionsRecyclerView sectionsRecycler,
@Prop Binder<RecyclerView> binder,
@Prop(optional = true) boolean hasFixedSize,
@Prop(optional = true) boolean clipToPadding,
@Prop(optional = true) int leftPadding,
@Prop(optional = true) int rightPadding,
@Prop(optional = true) int topPadding,
@Prop(optional = true) int bottomPadding,
@Prop(optional = true, resType = ResType.COLOR) @Nullable
Integer refreshProgressBarBackgroundColor,
@Prop(optional = true, resType = ResType.COLOR) int refreshProgressBarColor,
@Prop(optional = true) boolean clipChildren,
@Prop(optional = true) boolean nestedScrollingEnabled,
@Prop(optional = true) int scrollBarStyle,
@Prop(optional = true) RecyclerView.ItemDecoration itemDecoration,
@Prop(optional = true) boolean horizontalFadingEdgeEnabled,
@Prop(optional = true) boolean verticalFadingEdgeEnabled,
@Prop(optional = true, resType = ResType.DIMEN_SIZE) int fadingEdgeLength,
@Prop(optional = true) @IdRes int recyclerViewId,
@Prop(optional = true) int overScrollMode,
@Prop(optional = true, isCommonProp = true) CharSequence contentDescription,
@Prop(optional = true) ItemAnimator itemAnimator) {
final RecyclerView recyclerView = sectionsRecycler.getRecyclerView();
if (recyclerView == null) {
throw new IllegalStateException(
"RecyclerView not found, it should not be removed from SwipeRefreshLayout");
}
recyclerView.setContentDescription(contentDescription);
recyclerView.setHasFixedSize(hasFixedSize);
recyclerView.setClipToPadding(clipToPadding);
sectionsRecycler.setClipToPadding(clipToPadding);
ViewCompat.setPaddingRelative(
recyclerView, leftPadding, topPadding, rightPadding, bottomPadding);
recyclerView.setClipChildren(clipChildren);
sectionsRecycler.setClipChildren(clipChildren);
recyclerView.setNestedScrollingEnabled(nestedScrollingEnabled);
sectionsRecycler.setNestedScrollingEnabled(nestedScrollingEnabled);
recyclerView.setScrollBarStyle(scrollBarStyle);
recyclerView.setHorizontalFadingEdgeEnabled(horizontalFadingEdgeEnabled);
recyclerView.setVerticalFadingEdgeEnabled(verticalFadingEdgeEnabled);
recyclerView.setFadingEdgeLength(fadingEdgeLength);
// TODO (t14949498) determine if this is necessary
recyclerView.setId(recyclerViewId);
recyclerView.setOverScrollMode(overScrollMode);
if (refreshProgressBarBackgroundColor != null) {
sectionsRecycler.setProgressBackgroundColorSchemeColor(refreshProgressBarBackgroundColor);
}
sectionsRecycler.setColorSchemeColors(refreshProgressBarColor);
if (itemDecoration != null) {
recyclerView.addItemDecoration(itemDecoration);
}
sectionsRecycler.setItemAnimator(
itemAnimator != RecyclerSpec.itemAnimator ? itemAnimator : new NoUpdateItemAnimator());
binder.mount(recyclerView);
}