Added in API level 11

StackView

open class StackView : AdapterViewAnimator
kotlin.Any
   ↳ android.view.View
   ↳ android.view.ViewGroup
   ↳ android.widget.AdapterView<android.widget.Adapter>
   ↳ android.widget.AdapterViewAnimator
   ↳ android.widget.StackView

Summary

Inherited XML attributes
Inherited constants
Public constructors
StackView(context: Context!)

StackView(context: Context!, attrs: AttributeSet!)

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

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

Public methods
open Unit

open CharSequence!

open Boolean

open Boolean

Implement this method to intercept all touch screen motion events.

open Boolean

Implement this method to handle touch screen motion events.

open Unit

Manually shows the next child.

open Unit

Manually shows the previous child.

Protected methods
open Unit

open Unit
onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int)

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

Inherited functions
Inherited properties

Public constructors

StackView

Added in API level 11
StackView(context: Context!)

StackView

Added in API level 11
StackView(
    context: Context!,
    attrs: AttributeSet!)

StackView

Added in API level 11
StackView(
    context: Context!,
    attrs: AttributeSet!,
    defStyleAttr: Int)

StackView

Added in API level 11
StackView(
    context: Context!,
    attrs: AttributeSet!,
    defStyleAttr: Int,
    defStyleRes: Int)

Public methods

advance

Added in API level 11
open fun advance(): Unit

getAccessibilityClassName

Added in API level 23
open fun getAccessibilityClassName(): CharSequence!

onGenericMotionEvent

Added in API level 12
open fun onGenericMotionEvent(event: MotionEvent!): Boolean
Parameters
event MotionEvent!: The generic motion event being processed.
Return
Boolean True if the event was handled, false otherwise.

onInterceptTouchEvent

Added in API level 11
open fun onInterceptTouchEvent(ev: MotionEvent!): Boolean

Implement this method to intercept all touch screen motion events. This allows you to watch events as they are dispatched to your children, and take ownership of the current gesture at any point.

Using this function takes some care, as it has a fairly complicated interaction with View.onTouchEvent(MotionEvent), and using it requires implementing that method as well as this one in the correct way. Events will be received in the following order:

  1. You will receive the down event here.
  2. The down event will be handled either by a child of this view group, or given to your own onTouchEvent() method to handle; this means you should implement onTouchEvent() to return true, so you will continue to see the rest of the gesture (instead of looking for a parent view to handle it). Also, by returning true from onTouchEvent(), you will not receive any following events in onInterceptTouchEvent() and all touch processing must happen in onTouchEvent() like normal.
  3. For as long as you return false from this function, each following event (up to and including the final up) will be delivered first here and then to the target's onTouchEvent().
  4. If you return true from here, you will not receive any following events: the target view will receive the same event but with the action MotionEvent#ACTION_CANCEL, and all further events will be delivered to your onTouchEvent() method and no longer appear here.
Parameters
ev MotionEvent!: The motion event being dispatched down the hierarchy.
Return
Boolean Return true to steal motion events from the children and have them dispatched to this ViewGroup through onTouchEvent(). The current target will receive an ACTION_CANCEL event, and no further messages will be delivered here.

onTouchEvent

Added in API level 11
open fun onTouchEvent(ev: MotionEvent!): Boolean

Implement this method to handle touch screen motion events.

If this method is used to detect click actions, it is recommended that the actions be performed by implementing and calling performClick(). This will ensure consistent system behavior, including:

  • obeying click sound preferences
  • dispatching OnClickListener calls
  • handling ACTION_CLICK when accessibility features are enabled
Parameters
event The motion event.
Return
Boolean True if the event was handled, false otherwise.

showNext

Added in API level 11
open fun showNext(): Unit

Manually shows the next child.

showPrevious

Added in API level 11
open fun showPrevious(): Unit

Manually shows the previous child.

Protected methods

dispatchDraw

Added in API level 11
protected open fun dispatchDraw(canvas: Canvas): Unit
Parameters
canvas Canvas: This value cannot be null.

onLayout

Added in API level 11
protected open fun onLayout(
    changed: Boolean,
    left: Int,
    top: Int,
    right: Int,
    bottom: Int
): Unit
Parameters
changed Boolean: This is a new size or position for this view
left Int: Left position, relative to parent
top Int: Top position, relative to parent
right Int: Right position, relative to parent
bottom Int: Bottom position, relative to parent

onMeasure

Added in API level 11
protected open fun onMeasure(
    widthMeasureSpec: Int,
    heightMeasureSpec: Int
): Unit
Parameters
widthMeasureSpec Int: horizontal space requirements as imposed by the parent. The requirements are encoded with android.view.View.MeasureSpec.
heightMeasureSpec Int: vertical space requirements as imposed by the parent. The requirements are encoded with android.view.View.MeasureSpec.