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

The following examples show how to use android.widget.GridView#setVerticalScrollBarEnabled() . 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: EmoGridView.java    From sctalk with Apache License 2.0 6 votes vote down vote up
private GridView getViewPagerItem(final int index) {
    GridView gridView = new GridView(_context);
    gridView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,
            LayoutParams.WRAP_CONTENT));
    gridView.setNumColumns(7);
    gridView.setVerticalScrollBarEnabled(false);
    gridView.setHorizontalScrollBarEnabled(false);
    gridView.setPadding(8, 8, 8, 0);
    gridView.setVerticalSpacing(CommonUtil.getElementSzie(_context) / 2
            + CommonUtil.getElementSzie(_context) / 3);
    // gridView.setVerticalSpacing(30);
    gridView.setBackgroundColor(Color.TRANSPARENT);
    gridView.setAdapter(new EmoGridViewAdapter(_context,
            getGridViewData(index)));
    gridView.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view,
                int position, long id) {
            int start = index * (SysConstant.pageSize - 1);
            onEmoGridViewItemClick.onItemClick(position + start, index);
        }
    });
    return gridView;
}
 
Example 2
Source File: YayaEmoGridView.java    From sctalk with Apache License 2.0 6 votes vote down vote up
private GridView getViewPagerItem(final int index) {
    GridView gridView = new GridView(_context);
    gridView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,
            LayoutParams.WRAP_CONTENT));
    gridView.setNumColumns(4);
    gridView.setVerticalScrollBarEnabled(false);
    gridView.setHorizontalScrollBarEnabled(false);
    gridView.setPadding(8, 8, 8, 0);
    gridView.setVerticalSpacing(20);
    gridView.setSelector(new ColorDrawable(Color.TRANSPARENT));

    gridView.setAdapter(new YayaEmoGridViewAdapter(_context,
            getGridViewData(index)));
    gridView.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view,
                int position, long id) {
            int start = index * SysConstant.yayaPageSize;
            onEmoGridViewItemClick.onItemClick(position + start, index);
        }
    });
    return gridView;
}
 
Example 3
Source File: EmoticonPageView.java    From o2oa with GNU Affero General Public License v3.0 5 votes vote down vote up
public EmoticonPageView(Context context, AttributeSet attrs) {
    super(context, attrs);
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.item_emoticonpage, this);
    mGvEmotion = (GridView) view.findViewById(R.id.gv_emotion);

    if (Build.VERSION.SDK_INT > Build.VERSION_CODES.HONEYCOMB) {
        mGvEmotion.setMotionEventSplittingEnabled(false);
    }
    mGvEmotion.setStretchMode(GridView.STRETCH_COLUMN_WIDTH);
    mGvEmotion.setCacheColorHint(0);
    mGvEmotion.setSelector(new ColorDrawable(Color.TRANSPARENT));
    mGvEmotion.setVerticalScrollBarEnabled(false);
}
 
Example 4
Source File: EmoticonPageView.java    From aurora-imui with MIT License 5 votes vote down vote up
public EmoticonPageView(Context context, AttributeSet attrs) {
    super(context, attrs);
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.item_emoticonpage, this);
    mGvEmotion = (GridView) view.findViewById(R.id.gv_emotion);

    if (Build.VERSION.SDK_INT > Build.VERSION_CODES.HONEYCOMB) {
        mGvEmotion.setMotionEventSplittingEnabled(false);
    }
    mGvEmotion.setStretchMode(GridView.STRETCH_COLUMN_WIDTH);
    mGvEmotion.setCacheColorHint(0);
    mGvEmotion.setSelector(new ColorDrawable(Color.TRANSPARENT));
    mGvEmotion.setVerticalScrollBarEnabled(false);
}
 
Example 5
Source File: CalendarFragment.java    From MaterialCalendar with Apache License 2.0 5 votes vote down vote up
private void addGridView() {
        gridView = new GridView(this.getActivity());
        gridView.setNumColumns(7);
        gridView.setStretchMode(GridView.STRETCH_COLUMN_WIDTH);
        gridView.setGravity(Gravity.CENTER_VERTICAL);
        gridView.setSelector(new ColorDrawable(Color.TRANSPARENT));
        gridView.setHorizontalScrollBarEnabled(false);
        gridView.setVerticalScrollBarEnabled(false);
//        gridView.setVerticalSpacing(1);
//        gridView.setHorizontalSpacing(1);
        gridView.setOnTouchListener(new View.OnTouchListener() {
            // 将gridview中的触摸事件回传给gestureDetector

            public boolean onTouch(View v, MotionEvent event) {
                return gestureDetector.onTouchEvent(event);
            }
        });

        gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
                // 点击任何一个item,得到这个item的日期(排除点击的是周日到周六(点击不响应))
                int startPosition = calV.getStartPositon();
                int endPosition = calV.getEndPosition();
                if (startPosition <= position + 7 && position <= endPosition - 7) {
                    Day clickDay = calV.getItem(position);
                    Logger.d(clickDay.toString(), 2);
                    setTodayLunarInfo(clickDay);
//                    Toast.makeText(CalendarActivity.this, clickDay.toString(), Toast.LENGTH_SHORT).show();
                }
            }
        });
        gridView.setLayoutParams(new LinearLayout.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT, AbsListView.LayoutParams.WRAP_CONTENT));
    }
 
Example 6
Source File: BooksAroundMeFragment.java    From barterli_android with Apache License 2.0 4 votes vote down vote up
@Override
public View onCreateView(final LayoutInflater inflater,
                         final ViewGroup container, final Bundle savedInstanceState) {
    init(container, savedInstanceState);
    setHasOptionsMenu(true);

    final View contentView = inflater
            .inflate(R.layout.fragment_books_around_me, container, false);

    setActionBarTitle(R.string.app_name);
    setUpRefreshLayout(contentView);
    mBooksAroundMeGridView = (GridView) contentView
            .findViewById(R.id.grid_books_around_me);

    LoadMoreHelper.init(this).on(mBooksAroundMeGridView);

    mBooksAroundMeAdapter = new BooksGridAdapter(getActivity(), true);
    mBooksAroundMeGridView.setAdapter(mBooksAroundMeAdapter);
    mBooksAroundMeGridView.setOnItemClickListener(this);
    mBooksAroundMeGridView.setVerticalScrollBarEnabled(false);

    mEmptyView = contentView.findViewById(R.id.empty_view);

    mEmptyView.findViewById(R.id.text_try_again).setOnClickListener(this);
    mEmptyView.findViewById(R.id.text_add_your_own)
            .setOnClickListener(this);
    mEmptyView.findViewById(R.id.image_add_graphic)
            .setOnClickListener(this);

    mCurPage = SharedPreferenceHelper
            .getInt(R.string.pref_last_fetched_page, 0);
    if (savedInstanceState != null) {
        mLastFetchedLocation = savedInstanceState
                .getParcelable(Keys.LAST_FETCHED_LOCATION);
        mHasLoadedAllItems = savedInstanceState
                .getBoolean(Keys.HAS_LOADED_ALL_ITEMS);
    }
    mAddBookDialogFragment = (SingleChoiceDialogFragment) getFragmentManager()
            .findFragmentByTag(FragmentTags.DIALOG_ADD_BOOK);

    mEnableLocationDialogFragment = (EnableLocationDialogFragment) getFragmentManager()
            .findFragmentByTag(FragmentTags.DIALOG_ENABLE_LOCATION);

    loadBookSearchResults();
    return contentView;
}