本文整理匯總了Java中android.support.v7.widget.RecyclerView.setClipToPadding方法的典型用法代碼示例。如果您正苦於以下問題:Java RecyclerView.setClipToPadding方法的具體用法?Java RecyclerView.setClipToPadding怎麽用?Java RecyclerView.setClipToPadding使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.v7.widget.RecyclerView
的用法示例。
在下文中一共展示了RecyclerView.setClipToPadding方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCreateView
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
mRecyclerView = new RecyclerView(getContext());
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
mRecyclerView.setAdapter(new SimpleAdapter());
mRecyclerView.setClipToPadding(false);
mRecyclerView.setPadding(0, 0, 0,
(int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics()));
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
// track for determining animation direction.
mLastScrollOffsetY = dy;
}
});
return mRecyclerView;
}
示例2: createGridRecyclerView
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
protected RecyclerView createGridRecyclerView() {
RecyclerView gridRecyclerView = new AutoFitGridRecyclerView(getContext(), spanCountForGridLayout());
gridRecyclerView.setLayoutParams(generateLayoutParamsForRecyclerView());
gridRecyclerView.setHasFixedSize(true);
gridRecyclerView.setClipToPadding(false);
swipeRefresh.addView(gridRecyclerView);
return gridRecyclerView;
}
示例3: initViews
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
protected void initViews() {
inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.ultimate_recycler_view_layout, this);
mRecyclerView = (RecyclerView) view.findViewById(R.id.ultimate_list);
mSwipeRefreshLayout = (VerticalSwipeRefreshLayout) view.findViewById(R.id.swipe_refresh_layout);
setScrollbars();
mSwipeRefreshLayout.setEnabled(false);
if (mRecyclerView != null) {
mRecyclerView.setClipToPadding(mClipToPadding);
if (mPadding != -1.1f) {
mRecyclerView.setPadding(mPadding, mPadding, mPadding, mPadding);
} else {
mRecyclerView.setPadding(mPaddingLeft, mPaddingTop, mPaddingRight, mPaddingBottom);
}
}
defaultFloatingActionButton = (FloatingActionButton) view.findViewById(R.id.defaultFloatingActionButton);
setDefaultScrollListener();
/**
* empty view setup
*/
mEmpty = (ViewStub) view.findViewById(R.id.emptyview);
if (mEmptyId != 0) {
mEmpty.setLayoutResource(mEmptyId);
mEmptyView = mEmpty.inflate();
mEmpty.setVisibility(View.GONE);
}
/**
* floating button setup
*/
mFloatingButtonViewStub = (ViewStub) view.findViewById(R.id.floatingActionViewStub);
mFloatingButtonViewStub.setLayoutResource(mFloatingButtonId);
}
示例4: initViews
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
protected void initViews() {
//super.initViews();
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.custom_recycler_view_layout, this);
mRecyclerView = (RecyclerView) view.findViewById(R.id.ultimate_list);
mSwipeRefreshLayout = null;
if (mRecyclerView != null) {
mRecyclerView.setClipToPadding(mClipToPadding);
if (mPadding != -1.1f) {
mRecyclerView.setPadding(mPadding, mPadding, mPadding, mPadding);
} else {
mRecyclerView.setPadding(mPaddingLeft, mPaddingTop, mPaddingRight, mPaddingBottom);
}
}
defaultFloatingActionButton = (FloatingActionButton) view.findViewById(R.id.defaultFloatingActionButton);
setDefaultScrollListener();
mEmpty = (ViewStub) view.findViewById(R.id.emptyview);
mFloatingButtonViewStub = (ViewStub) view.findViewById(R.id.floatingActionViewStub);
mEmpty.setLayoutResource(mEmptyId);
mFloatingButtonViewStub.setLayoutResource(mFloatingButtonId);
if (mEmptyId != 0)
mEmptyView = mEmpty.inflate();
mEmpty.setVisibility(View.GONE);
if (mFloatingButtonId != 0) {
mFloatingButtonView = mFloatingButtonViewStub.inflate();
mFloatingButtonView.setVisibility(View.VISIBLE);
}
}
示例5: onCreateView
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
mRecyclerView = new RecyclerView(inflater.getContext());
/* mRecyclerView.setPadding(
(int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 20, getResources().getDisplayMetrics()),
(int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics()),
(int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 20, getResources().getDisplayMetrics()),
0
);*/
mRecyclerView.setClipToPadding(false);
mRecyclerView.setClipChildren(false);
return mRecyclerView;
}
示例6: prepareListView
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
private void prepareListView(Context context) {
mListView = new RecyclerView(context);
mAdapter = new ItemAdapter();
mListView.setClipToPadding(false);
mListView.setPadding(0, getResources().getDimensionPixelSize(R.dimen.stepper_margin_top), 0, 0);
mListView.addItemDecoration(new VerticalSpaceItemDecoration(
getResources().getDimensionPixelSize(R.dimen.vertical_stepper_item_space_height)));
mListView.setLayoutManager(new LinearLayoutManager(context));
mListView.setAdapter(mAdapter);
addView(mListView, new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
}
示例7: getItemOffsets
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
/**
* set the border around the View
*/
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
if (parent.getPaddingLeft() != _borderSpace) {
parent.setPadding(_borderSpace, _borderSpace, _borderSpace, _borderSpace);
parent.setClipToPadding(false);
}
outRect.top = _borderSpace;
outRect.bottom = _borderSpace;
outRect.left = _borderSpace;
outRect.right = _borderSpace;
}
示例8: 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;
}
}
}