Java Code Examples for android.widget.ListView#setOverScrollMode()

The following examples show how to use android.widget.ListView#setOverScrollMode() . These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    View rootView = getView();
    if (rootView != null) {
        ListView listView = rootView.findViewById(android.R.id.list);
        if (listView != null) {
            listView.setOverScrollMode(View.OVER_SCROLL_IF_CONTENT_SCROLLS);
            listView.setVerticalScrollBarEnabled(false);
            listView.setDivider(null);
            listView.setDividerHeight(0);
        }
    }
}
 
Example 2
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    ListView listView = view.findViewById(android.R.id.list);
    if (listView != null) {
        listView.setVerticalScrollBarEnabled(false);
        listView.setOverScrollMode(View.OVER_SCROLL_NEVER);
    }
}
 
Example 3
private void init(Context context, AttributeSet attrs) {
    mContext = context;

    if (attrs != null) {
        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.IndexableStickyListView);
        mBarTextColor = a.getColor(R.styleable.IndexableStickyListView_indexBar_textColor, getResources().getColor(R.color.default_indexBar_textcolor));
        mBarTextSize = a.getDimension(R.styleable.IndexableStickyListView_indexBar_textSize, getResources().getDimension(R.dimen.default_indexBar_textSize));
        mBarSelectedTextColor = a.getColor(R.styleable.IndexableStickyListView_indexBar_selected_textColor, getResources().getColor(R.color.dafault_indexBar_selected_textColor));
        mRightOverlayColor = a.getColor(R.styleable.IndexableStickyListView_indexListView_rightOverlayColor, getResources().getColor(R.color.default_indexListView_rightOverlayColor));
        mTypeOverlay = a.getInt(R.styleable.IndexableStickyListView_indexListView_type_overlay, 0);
        a.recycle();
    }


    if (mContext instanceof Activity) {
        ((Activity) mContext).getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
    }

    mListView = new ListView(context);
    mListView.setVerticalScrollBarEnabled(false);
    mListView.setOverScrollMode(View.OVER_SCROLL_NEVER);
    mListView.setDivider(null);
    addView(mListView, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));

    mIndexBar = new IndexBar(context, mBarTextColor, mBarSelectedTextColor, mBarTextSize);
    LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
    params.gravity = Gravity.RIGHT;
    params.topMargin = IndexBar.dp2px(context, 16);
    params.bottomMargin = params.topMargin;
    addView(mIndexBar, params);
    if (mTypeOverlay == 1) {
        showCenterOverlayView(true);
    } else if (mTypeOverlay == 2) {
        showRightOverlayView(true, mRightOverlayColor);
    }

    mSearchLayout = new SearchLayout(context);
    LayoutParams paramsLayout = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    addView(mSearchLayout, paramsLayout);
    mSearchLayout.setVisibility(GONE);

    mListView.setOnItemClickListener(this);
    mListView.setOnScrollListener(this);

    mIndexBar.setOnIndexSelectedListener(new IndexBar.OnIndexTitleSelectedListener() {
        @Override
        public void onSelection(int position, String indexTitle) {
            if (mStickView != null) {
                if (!mStickView.getText().toString().equals(indexTitle)) {
                    mStickView.setText(indexTitle);
                }
                if (mStickView.getY() != 0) {
                    mStickView.setY(0);
                }
            }
        }
    });
}