public interface

ScrollingView

 androidx.core.view.ScrollingView

Subclasses:

NestedScrollView, RecyclerView, WearableRecyclerView, HorizontalGridView, BaseGridView, VerticalGridView

Gradle dependencies

compile group: 'androidx.core', name: 'core', version: '1.15.0-alpha02'

  • groupId: androidx.core
  • artifactId: core
  • version: 1.15.0-alpha02

Artifact androidx.core:core:1.15.0-alpha02 it located at Google repository (https://maven.google.com/)

Androidx artifact mapping:

androidx.core:core com.android.support:support-compat

Androidx class mapping:

androidx.core.view.ScrollingView android.support.v4.view.ScrollingView

Overview

An interface that can be implemented by Views to provide scroll related APIs.

Summary

Methods
public intcomputeHorizontalScrollExtent()

Compute the horizontal extent of the horizontal scrollbar's thumb within the horizontal range.

public intcomputeHorizontalScrollOffset()

Compute the horizontal offset of the horizontal scrollbar's thumb within the horizontal range.

public intcomputeHorizontalScrollRange()

Compute the horizontal range that the horizontal scrollbar represents.

public intcomputeVerticalScrollExtent()

Compute the vertical extent of the vertical scrollbar's thumb within the vertical range.

public intcomputeVerticalScrollOffset()

Compute the vertical offset of the vertical scrollbar's thumb within the horizontal range.

public intcomputeVerticalScrollRange()

Compute the vertical range that the vertical scrollbar represents.

Methods

public int computeHorizontalScrollRange()

Compute the horizontal range that the horizontal scrollbar represents.

The range is expressed in arbitrary units that must be the same as the units used by ScrollingView.computeHorizontalScrollExtent() and ScrollingView.computeHorizontalScrollOffset().

The default range is the drawing width of this view.

Returns:

the total horizontal range represented by the horizontal scrollbar

See also: ScrollingView.computeHorizontalScrollExtent(), ScrollingView.computeHorizontalScrollOffset()

public int computeHorizontalScrollOffset()

Compute the horizontal offset of the horizontal scrollbar's thumb within the horizontal range. This value is used to compute the position of the thumb within the scrollbar's track.

The range is expressed in arbitrary units that must be the same as the units used by ScrollingView.computeHorizontalScrollRange() and ScrollingView.computeHorizontalScrollExtent().

The default offset is the scroll offset of this view.

Returns:

the horizontal offset of the scrollbar's thumb

See also: ScrollingView.computeHorizontalScrollRange(), ScrollingView.computeHorizontalScrollExtent()

public int computeHorizontalScrollExtent()

Compute the horizontal extent of the horizontal scrollbar's thumb within the horizontal range. This value is used to compute the length of the thumb within the scrollbar's track.

The range is expressed in arbitrary units that must be the same as the units used by ScrollingView.computeHorizontalScrollRange() and ScrollingView.computeHorizontalScrollOffset().

The default extent is the drawing width of this view.

Returns:

the horizontal extent of the scrollbar's thumb

See also: ScrollingView.computeHorizontalScrollRange(), ScrollingView.computeHorizontalScrollOffset()

public int computeVerticalScrollRange()

Compute the vertical range that the vertical scrollbar represents.

The range is expressed in arbitrary units that must be the same as the units used by ScrollingView.computeVerticalScrollExtent() and ScrollingView.computeVerticalScrollOffset().

Returns:

the total vertical range represented by the vertical scrollbar

The default range is the drawing height of this view.

See also: ScrollingView.computeVerticalScrollExtent(), ScrollingView.computeVerticalScrollOffset()

public int computeVerticalScrollOffset()

Compute the vertical offset of the vertical scrollbar's thumb within the horizontal range. This value is used to compute the position of the thumb within the scrollbar's track.

The range is expressed in arbitrary units that must be the same as the units used by ScrollingView.computeVerticalScrollRange() and ScrollingView.computeVerticalScrollExtent().

The default offset is the scroll offset of this view.

Returns:

the vertical offset of the scrollbar's thumb

See also: ScrollingView.computeVerticalScrollRange(), ScrollingView.computeVerticalScrollExtent()

public int computeVerticalScrollExtent()

Compute the vertical extent of the vertical scrollbar's thumb within the vertical range. This value is used to compute the length of the thumb within the scrollbar's track.

The range is expressed in arbitrary units that must be the same as the units used by ScrollingView.computeVerticalScrollRange() and ScrollingView.computeVerticalScrollOffset().

The default extent is the drawing height of this view.

Returns:

the vertical extent of the scrollbar's thumb

See also: ScrollingView.computeVerticalScrollRange(), ScrollingView.computeVerticalScrollOffset()

Source

/*
 * Copyright 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package androidx.core.view;

/**
 * An interface that can be implemented by Views to provide scroll related APIs.
 */
public interface ScrollingView {
    /**
     * <p>Compute the horizontal range that the horizontal scrollbar
     * represents.</p>
     *
     * <p>The range is expressed in arbitrary units that must be the same as the
     * units used by {@link #computeHorizontalScrollExtent()} and
     * {@link #computeHorizontalScrollOffset()}.</p>
     *
     * <p>The default range is the drawing width of this view.</p>
     *
     * @return the total horizontal range represented by the horizontal
     *         scrollbar
     *
     * @see #computeHorizontalScrollExtent()
     * @see #computeHorizontalScrollOffset()
     */
    int computeHorizontalScrollRange();

    /**
     * <p>Compute the horizontal offset of the horizontal scrollbar's thumb
     * within the horizontal range. This value is used to compute the position
     * of the thumb within the scrollbar's track.</p>
     *
     * <p>The range is expressed in arbitrary units that must be the same as the
     * units used by {@link #computeHorizontalScrollRange()} and
     * {@link #computeHorizontalScrollExtent()}.</p>
     *
     * <p>The default offset is the scroll offset of this view.</p>
     *
     * @return the horizontal offset of the scrollbar's thumb
     *
     * @see #computeHorizontalScrollRange()
     * @see #computeHorizontalScrollExtent()
     */
    int computeHorizontalScrollOffset();

    /**
     * <p>Compute the horizontal extent of the horizontal scrollbar's thumb
     * within the horizontal range. This value is used to compute the length
     * of the thumb within the scrollbar's track.</p>
     *
     * <p>The range is expressed in arbitrary units that must be the same as the
     * units used by {@link #computeHorizontalScrollRange()} and
     * {@link #computeHorizontalScrollOffset()}.</p>
     *
     * <p>The default extent is the drawing width of this view.</p>
     *
     * @return the horizontal extent of the scrollbar's thumb
     *
     * @see #computeHorizontalScrollRange()
     * @see #computeHorizontalScrollOffset()
     */
    int computeHorizontalScrollExtent();

    /**
     * <p>Compute the vertical range that the vertical scrollbar represents.</p>
     *
     * <p>The range is expressed in arbitrary units that must be the same as the
     * units used by {@link #computeVerticalScrollExtent()} and
     * {@link #computeVerticalScrollOffset()}.</p>
     *
     * @return the total vertical range represented by the vertical scrollbar
     *
     * <p>The default range is the drawing height of this view.</p>
     *
     * @see #computeVerticalScrollExtent()
     * @see #computeVerticalScrollOffset()
     */
    int computeVerticalScrollRange();

    /**
     * <p>Compute the vertical offset of the vertical scrollbar's thumb
     * within the horizontal range. This value is used to compute the position
     * of the thumb within the scrollbar's track.</p>
     *
     * <p>The range is expressed in arbitrary units that must be the same as the
     * units used by {@link #computeVerticalScrollRange()} and
     * {@link #computeVerticalScrollExtent()}.</p>
     *
     * <p>The default offset is the scroll offset of this view.</p>
     *
     * @return the vertical offset of the scrollbar's thumb
     *
     * @see #computeVerticalScrollRange()
     * @see #computeVerticalScrollExtent()
     */
    int computeVerticalScrollOffset();

    /**
     * <p>Compute the vertical extent of the vertical scrollbar's thumb
     * within the vertical range. This value is used to compute the length
     * of the thumb within the scrollbar's track.</p>
     *
     * <p>The range is expressed in arbitrary units that must be the same as the
     * units used by {@link #computeVerticalScrollRange()} and
     * {@link #computeVerticalScrollOffset()}.</p>
     *
     * <p>The default extent is the drawing height of this view.</p>
     *
     * @return the vertical extent of the scrollbar's thumb
     *
     * @see #computeVerticalScrollRange()
     * @see #computeVerticalScrollOffset()
     */
    int computeVerticalScrollExtent();
}