Java Code Examples for android.view.View#SCROLLBAR_POSITION_DEFAULT

The following examples show how to use android.view.View#SCROLLBAR_POSITION_DEFAULT . 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: FastScroller.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
public void setScrollbarPosition(int position) {
    if (position == View.SCROLLBAR_POSITION_DEFAULT) {
        position = mList.isLayoutRtl() ?
                View.SCROLLBAR_POSITION_LEFT : View.SCROLLBAR_POSITION_RIGHT;
    }

    if (mScrollbarPosition != position) {
        mScrollbarPosition = position;
        mLayoutFromRight = position != View.SCROLLBAR_POSITION_LEFT;

        final int previewResId = mPreviewResId[mLayoutFromRight ? PREVIEW_RIGHT : PREVIEW_LEFT];
        mPreviewImage.setBackgroundResource(previewResId);

        // Propagate padding to text min width/height.
        final int textMinWidth = Math.max(0, mPreviewMinWidth - mPreviewImage.getPaddingLeft()
                - mPreviewImage.getPaddingRight());
        mPrimaryText.setMinimumWidth(textMinWidth);
        mSecondaryText.setMinimumWidth(textMinWidth);

        final int textMinHeight = Math.max(0, mPreviewMinHeight - mPreviewImage.getPaddingTop()
                - mPreviewImage.getPaddingBottom());
        mPrimaryText.setMinimumHeight(textMinHeight);
        mSecondaryText.setMinimumHeight(textMinHeight);

        // Requires re-layout.
        updateLayout();
    }
}