Java Code Examples for android.widget.GridView#setClipToPadding()

The following examples show how to use android.widget.GridView#setClipToPadding() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GridExampleFragment.java    From ShadowDrawable with MIT License 5 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
	gridView = new GridView(getActivity());
	gridView.setClipToPadding(false);
	int padding = 18 * 3;
	gridView.setPadding(padding, padding, padding, padding);
	return gridView;
}
 
Example 2
Source File: SuperGridview.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
@Override
protected void initAbsListView(View v) {

    View listView = v.findViewById(android.R.id.list);
    if (listView instanceof GridView)
        mList = (GridView) listView;
    else
        throw new IllegalArgumentException(listView.getClass().getName());

    if (mList!=null) {

        getList().setNumColumns(mColumns);
        getList().setVerticalSpacing(mVerticalSpacing);
        getList().setHorizontalSpacing(mHorizontalSpacing);
        getList().setHorizontalSpacing((int) mDividerHeight);
        getList().setVerticalSpacing((int) mDividerHeight);

        mList.setClipToPadding(mClipToPadding);

        mList.setOnScrollListener(this);
        if (mSelector != 0)
            mList.setSelector(mSelector);

        if (mPadding != -1.0f) {
            mList.setPadding(mPadding, mPadding, mPadding, mPadding);
        } else {
            mList.setPadding(mPaddingLeft, mPaddingTop, mPaddingRight, mPaddingBottom);
        }

        mList.setScrollBarStyle(mScrollbarStyle);
    }
}