Added in API level 3

HorizontalScrollView


open class HorizontalScrollView : FrameLayout
kotlin.Any
   ↳ android.view.View
   ↳ android.view.ViewGroup
   ↳ android.widget.FrameLayout
   ↳ android.widget.HorizontalScrollView

Layout container for a view hierarchy that can be scrolled by the user, allowing it to be larger than the physical display. A HorizontalScrollView is a FrameLayout, meaning you should place one child in it containing the entire contents to scroll; this child may itself be a layout manager with a complex hierarchy of objects. A child that is often used is a LinearLayout in a horizontal orientation, presenting a horizontal array of top-level items that the user can scroll through.

The TextView class also takes care of its own scrolling, so does not require a HorizontalScrollView, but using the two together is possible to achieve the effect of a text view within a larger container.

HorizontalScrollView only supports horizontal scrolling. For vertical scrolling, use either ScrollView or ListView.

Summary

XML attributes
android:fillViewport Defines whether the scrollview should stretch its content to fill the viewport.
Inherited XML attributes
Inherited constants
Public constructors

HorizontalScrollView(context: Context!, attrs: AttributeSet!, defStyleAttr: Int)

HorizontalScrollView(context: Context!, attrs: AttributeSet!, defStyleAttr: Int, defStyleRes: Int)

Public methods
open Unit
addView(child: View!)

open Unit
addView(child: View!, params: ViewGroup.LayoutParams!)

open Unit
addView(child: View!, index: Int)

open Unit
addView(child: View!, index: Int, params: ViewGroup.LayoutParams!)

open Boolean
arrowScroll(direction: Int)

Handle scrolling in response to a left or right arrow click.

open Unit

open Boolean

open Unit
draw(canvas: Canvas)

open Boolean

You can call this function yourself to have the scroll view perform scrolling from a key event, just as if the event had been dispatched to it by the view hierarchy.

open Unit
fling(velocityX: Int)

Fling the scroll view

open Boolean
fullScroll(direction: Int)

Handles scrolling in response to a "home/end" shortcut press.

open CharSequence!

open Int

Returns the left edge effect color.

open Int

open Int

Returns the right edge effect color.

open Boolean

Indicates whether this HorizontalScrollView's content is stretched to fill the viewport.

open Boolean

open Boolean

open Boolean

open Boolean

open Boolean
pageScroll(direction: Int)

Handles scrolling in response to a "page up/down" shortcut press.

open Unit
requestChildFocus(child: View!, focused: View!)

open Boolean
requestChildRectangleOnScreen(child: View, rectangle: Rect!, immediate: Boolean)

open Unit

open Unit

open Unit
scrollTo(x: Int, y: Int)

Set the scrolled position of your view.

open Unit

Sets the edge effect color for both left and right edge effects.

open Unit
setFillViewport(fillViewport: Boolean)

Indicates this HorizontalScrollView whether it should stretch its content width to fill the viewport or not.

open Unit

Sets the left edge effect color.

open Unit

Sets the right edge effect color.

open Unit
setSmoothScrollingEnabled(smoothScrollingEnabled: Boolean)

Set whether arrow scrolling will animate its transition.

open Boolean

Unit
smoothScrollBy(dx: Int, dy: Int)

Like View.scrollBy, but scroll smoothly instead of immediately.

Unit

Like scrollTo, but scroll smoothly instead of immediately.

Protected methods
open Int

open Int

The scroll range of a scroll view is the overall width of all of its children.

open Int

Compute the amount to scroll in the X direction in order to get a rectangle completely on the screen (or, if taller than the screen, at least the first screen size chunk of it).

open Float

open Float

open Unit
measureChild(child: View!, parentWidthMeasureSpec: Int, parentHeightMeasureSpec: Int)

open Unit
measureChildWithMargins(child: View!, parentWidthMeasureSpec: Int, widthUsed: Int, parentHeightMeasureSpec: Int, heightUsed: Int)

open Unit
onLayout(changed: Boolean, l: Int, t: Int, r: Int, b: Int)

open Unit
onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int)

open Unit
onOverScrolled(scrollX: Int, scrollY: Int, clampedX: Boolean, clampedY: Boolean)

open Boolean
onRequestFocusInDescendants(direction: Int, previouslyFocusedRect: Rect!)

When looking for focus in children of a scroll view, need to be a little more careful not to give focus to something that is scrolled off screen.

open Unit

open Parcelable?

open Unit
onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int)

Inherited functions