本文整理匯總了Java中android.support.v7.widget.RecyclerView.setScrollBarStyle方法的典型用法代碼示例。如果您正苦於以下問題:Java RecyclerView.setScrollBarStyle方法的具體用法?Java RecyclerView.setScrollBarStyle怎麽用?Java RecyclerView.setScrollBarStyle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.v7.widget.RecyclerView
的用法示例。
在下文中一共展示了RecyclerView.setScrollBarStyle方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setRecyclerView
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
public void setRecyclerView(RecyclerView recyclerView) {
recyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 3));
recyclerView.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY);
((SimpleItemAnimator)recyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
int i = getResources().getDisplayMetrics().widthPixels;
int y = DensityUtil.dp2px(getContext(), 90);
int p = DensityUtil.dp2px(getContext(), 15);
int padding = (3 * y + 2 * 3 * p + 2 * p - i) / (2 * 3);
recyclerView.setPadding(
padding,
DensityUtil.dp2px(getContext(), 8),
padding,
DensityUtil.dp2px(getContext(), 8)
);
}
示例2: initRecyclerView
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
/**
* Implement this method to customize the AbsListView
*/
protected void initRecyclerView(View view) {
mRecycler = (RecyclerView) view.findViewById(android.R.id.list);
tipView = (TextView) view.findViewById(R.id.tvTip);
setItemAnimator(null);
if (mRecycler != null) {
mRecycler.setHasFixedSize(true);
mRecycler.setClipToPadding(mClipToPadding);
mInternalOnScrollListener = new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
if (mExternalOnScrollListener != null)
mExternalOnScrollListener.onScrolled(recyclerView, dx, dy);
}
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
if (mExternalOnScrollListener != null)
mExternalOnScrollListener.onScrollStateChanged(recyclerView, newState);
}
};
mRecycler.addOnScrollListener(mInternalOnScrollListener);
if (mPadding != -1.0f) {
mRecycler.setPadding(mPadding, mPadding, mPadding, mPadding);
} else {
mRecycler.setPadding(mPaddingLeft, mPaddingTop, mPaddingRight, mPaddingBottom);
}
if (mScrollbarStyle != -1) {
mRecycler.setScrollBarStyle(mScrollbarStyle);
}
switch (mScrollbar) {
case 0:
setVerticalScrollBarEnabled(false);
break;
case 1:
setHorizontalScrollBarEnabled(false);
break;
case 2:
setVerticalScrollBarEnabled(false);
setHorizontalScrollBarEnabled(false);
break;
}
}
}
示例3: setRecyclerView
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
public void setRecyclerView(RecyclerView recyclerView) {
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
recyclerView.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY);
}