belongs to Maven artifact com.android.support:leanback-v17:28.0.0-alpha1
Picker
public
class
Picker
extends FrameLayout
java.lang.Object | ||||
↳ | android.view.View | |||
↳ | android.view.ViewGroup | |||
↳ | android.widget.FrameLayout | |||
↳ | android.support.v17.leanback.widget.picker.Picker |
![]() |
Picker is a widget showing multiple customized PickerColumn
s. The PickerColumns are
initialized in setColumns(List)
. Call setColumnAt(int, PickerColumn)
if the
column value range or labels change. Call setColumnValue(int, int, boolean)
to update
the current value of PickerColumn.
Picker has two states and will change height:
isActivated()
is true: Picker shows typically three items vertically (see
getActivatedVisibleItemCount()
}. Columns other than getSelectedColumn()
still
shows one item if the Picker is focused. On a touch screen device, the Picker will not get focus
so it always show three items on all columns. On a non-touch device (a TV), the Picker will show
three items only on currently activated column. If the Picker has focus, it will intercept DPAD
directions and select activated column.
isActivated()
is false: Picker shows one item vertically (see
getVisibleItemCount()
) on all columns. The size of Picker shrinks.
Summary
Nested classes | |
---|---|
interface |
Picker.PickerValueListener
|
Inherited constants |
---|
![]()
android.view.ViewGroup
|
![]()
android.view.View
|
Inherited fields |
---|
![]()
android.view.View
|
Public constructors | |
---|---|
Picker(Context context, AttributeSet attrs, int defStyleAttr)
Creates a Picker widget. |
Public methods | |
---|---|
void
|
addOnValueChangedListener(Picker.PickerValueListener listener)
Register a callback to be invoked when the picker's value has changed. |
boolean
|
dispatchKeyEvent(KeyEvent event)
|
float
|
getActivatedVisibleItemCount()
Returns number of visible items showing in a column when it's activated. |
PickerColumn
|
getColumnAt(int colIndex)
Get nth PickerColumn. |
int
|
getColumnsCount()
Get number of PickerColumns. |
final
int
|
getPickerItemLayoutId()
Classes extending |
final
int
|
getPickerItemTextViewId()
Returns the |
int
|
getSelectedColumn()
Get current activated column index. |
final
CharSequence
|
getSeparator()
This method was deprecated
in API level 27.1.0.
Use |
final
List<CharSequence>
|
getSeparators()
Returns the list of separators that will be populated between the picker column fields. |
float
|
getVisibleItemCount()
Returns number of visible items showing in a column when it's not activated. |
void
|
onColumnValueChanged(int columnIndex, int newValue)
Classes extending |
void
|
removeOnValueChangedListener(Picker.PickerValueListener listener)
Remove a previously installed value changed callback |
void
|
requestChildFocus(View child, View focused)
|
void
|
setActivated(boolean activated)
|
void
|
setActivatedVisibleItemCount(float visiblePickerItems)
Changes number of visible items showing in a column when it's activated. |
void
|
setColumnAt(int columnIndex, PickerColumn column)
When column labels change or column range changes, call this function to re-populate the selection list. |
void
|
setColumnValue(int columnIndex, int value, boolean runAnimation)
Manually set current value of a column. |
void
|
setColumns(List<PickerColumn> columns)
Set columns and create Views. |
final
void
|
setPickerItemTextViewId(int textViewId)
Sets the |
void
|
setSelectedColumn(int columnIndex)
Change current selected column. |
final
void
|
setSeparator(CharSequence separator)
Sets separator String between Picker columns. |
final
void
|
setSeparators(List<CharSequence> separators)
Sets the list of separators that will be populated between the Picker columns. |
void
|
setVisibleItemCount(float pickerItems)
Changes number of visible items showing in a column when it's not activated. |
Protected methods | |
---|---|
int
|
getPickerItemHeightPixels()
Classes extending |
|