AI2 Component  (Version nb184)
com.google.appinventor.components.runtime.ListView Class Reference
Inheritance diagram for com.google.appinventor.components.runtime.ListView:
com.google.appinventor.components.runtime.AndroidViewComponent com.google.appinventor.components.runtime.VisibleComponent com.google.appinventor.components.runtime.Component

Public Member Functions

 ListView (ComponentContainer container)
 
View getView ()
 
void Height (int height)
 
void Width (int width)
 
void ShowFilterBar (boolean showFilter)
 
boolean ShowFilterBar ()
 
void Elements (YailList itemsList)
 
YailList Elements ()
 
void ElementsFromString (String itemstring)
 
void setAdapterData ()
 
Spannable[] itemsToColoredText ()
 
int SelectionIndex ()
 
void SelectionIndex (int index)
 
String Selection ()
 
void Selection (String value)
 
void onItemClick (AdapterView<?> parent, View view, int position, long id)
 
void onItemSelected (AdapterView<?> adapterView, View view, int i, long l)
 
void onNothingSelected (AdapterView<?> adapterView)
 
void AfterPicking ()
 
void setBackgroundColor (int color)
 
int BackgroundColor ()
 
void BackgroundColor (int argb)
 
int SelectionColor ()
 
void SelectionColor (int argb)
 
int TextColor ()
 
void TextColor (int argb)
 
int TextSize ()
 
void TextSize (int fontSize)
 
- Public Member Functions inherited from com.google.appinventor.components.runtime.AndroidViewComponent
boolean Visible ()
 
void Visible (boolean visibility)
 
int Width ()
 
void WidthPercent (int pCent)
 
void setLastWidth (int width)
 
int getSetWidth ()
 
void setLastHeight (int height)
 
int getSetHeight ()
 
void CopyWidth (AndroidViewComponent sourceComponent)
 
int Height ()
 
void HeightPercent (int pCent)
 
void CopyHeight (AndroidViewComponent sourceComponent)
 
int Column ()
 
void Column (int column)
 
int Row ()
 
void Row (int row)
 
HandlesEventDispatching getDispatchDelegate ()
 

Protected Attributes

final ComponentContainer container
 
- Protected Attributes inherited from com.google.appinventor.components.runtime.AndroidViewComponent
final ComponentContainer container
 

Additional Inherited Members

- Static Public Attributes inherited from com.google.appinventor.components.runtime.Component
static final String ASSET_DIRECTORY = "component"
 
static final int ALIGNMENT_NORMAL = 0
 
static final int ALIGNMENT_CENTER = 1
 
static final int ALIGNMENT_OPPOSITE = 2
 
static final int ACCELEROMETER_SENSITIVITY_WEAK = 1
 
static final int ACCELEROMETER_SENSITIVITY_MODERATE = 2
 
static final int ACCELEROMETER_SENSITIVITY_STRONG = 3
 
static final int BUTTON_SHAPE_DEFAULT = 0
 
static final int BUTTON_SHAPE_ROUNDED = 1
 
static final int BUTTON_SHAPE_RECT = 2
 
static final int BUTTON_SHAPE_OVAL = 3
 
static final int COLOR_NONE = 0x00FFFFFF
 
static final int COLOR_BLACK = 0xFF000000
 
static final int COLOR_BLUE = 0xFF0000FF
 
static final int COLOR_CYAN = 0xFF00FFFF
 
static final int COLOR_DKGRAY = 0xFF444444
 
static final int COLOR_GRAY = 0xFF888888
 
static final int COLOR_GREEN = 0xFF00FF00
 
static final int COLOR_LTGRAY = 0xFFCCCCCC
 
static final int COLOR_MAGENTA = 0xFFFF00FF
 
static final int COLOR_ORANGE = 0xFFFFC800
 
static final int COLOR_PINK = 0xFFFFAFAF
 
static final int COLOR_RED = 0xFFFF0000
 
static final int COLOR_WHITE = 0xFFFFFFFF
 
static final int COLOR_YELLOW = 0xFFFFFF00
 
static final int COLOR_DEFAULT = 0x00000000
 
static final String DEFAULT_VALUE_COLOR_NONE = "&H00FFFFFF"
 
static final String DEFAULT_VALUE_COLOR_BLACK = "&HFF000000"
 
static final String DEFAULT_VALUE_COLOR_BLUE = "&HFF0000FF"
 
static final String DEFAULT_VALUE_COLOR_CYAN = "&HFF00FFFF"
 
static final String DEFAULT_VALUE_COLOR_DKGRAY = "&HFF444444"
 
static final String DEFAULT_VALUE_COLOR_GRAY = "&HFF888888"
 
static final String DEFAULT_VALUE_COLOR_GREEN = "&HFF00FF00"
 
static final String DEFAULT_VALUE_COLOR_LTGRAY = "&HFFCCCCCC"
 
static final String DEFAULT_VALUE_COLOR_MAGENTA = "&HFFFF00FF"
 
static final String DEFAULT_VALUE_COLOR_ORANGE = "&HFFFFC800"
 
static final String DEFAULT_VALUE_COLOR_PINK = "&HFFFFAFAF"
 
static final String DEFAULT_VALUE_COLOR_RED = "&HFFFF0000"
 
static final String DEFAULT_VALUE_COLOR_WHITE = "&HFFFFFFFF"
 
static final String DEFAULT_VALUE_COLOR_YELLOW = "&HFFFFFF00"
 
static final String DEFAULT_VALUE_COLOR_DEFAULT = "&H00000000"
 
static final float FONT_DEFAULT_SIZE = 14
 
static final int LAYOUT_ORIENTATION_HORIZONTAL = ComponentConstants.LAYOUT_ORIENTATION_HORIZONTAL
 
static final int LAYOUT_ORIENTATION_VERTICAL = ComponentConstants.LAYOUT_ORIENTATION_VERTICAL
 
static final int SCALING_SCALE_PROPORTIONALLY = 0
 
static final int SCALING_SCALE_TO_FIT = 1
 
static final int TYPEFACE_DEFAULT = 0
 
static final int TYPEFACE_SANSSERIF = 1
 
static final int TYPEFACE_SERIF = 2
 
static final int TYPEFACE_MONOSPACE = 3
 
static final int LENGTH_PREFERRED = -1
 
static final int LENGTH_FILL_PARENT = -2
 
static final int LENGTH_UNKNOWN = -3
 
static final int LENGTH_PERCENT_TAG = -1000
 
static final int TOAST_LENGTH_SHORT = 0
 
static final int TOAST_LENGTH_LONG = 1
 
static final int DIRECTION_NORTH = 1
 
static final int DIRECTION_NORTHEAST = 2
 
static final int DIRECTION_EAST = 3
 
static final int DIRECTION_SOUTHEAST = 4
 
static final int DIRECTION_SOUTH = -1
 
static final int DIRECTION_SOUTHWEST = -2
 
static final int DIRECTION_WEST = -3
 
static final int DIRECTION_NORTHWEST = -4
 
static final int DIRECTION_NONE = 0
 
static final int DIRECTION_MIN = -4
 
static final int DIRECTION_MAX = 4
 
static float SLIDER_MIN_VALUE = 10
 
static float SLIDER_MAX_VALUE = 50
 
static float SLIDER_THUMB_VALUE = (SLIDER_MIN_VALUE + SLIDER_MAX_VALUE) / 2.0f
 
static final String DEFAULT_VALUE_TEXT_TO_SPEECH_COUNTRY = ""
 
static final String DEFAULT_VALUE_TEXT_TO_SPEECH_LANGUAGE = ""
 
- Protected Member Functions inherited from com.google.appinventor.components.runtime.AndroidViewComponent
 AndroidViewComponent (ComponentContainer container)
 
- Protected Member Functions inherited from com.google.appinventor.components.runtime.VisibleComponent
 VisibleComponent ()
 

Detailed Description

This is a visible component that allows to place a list of text elements in your Form to display. The list can be set using the ElementsFromString(String) property or using the Elements(YailList) block in the blocks editor.

Warning: This component will not work correctly on Screens that are scrollable if its Height(int) is set to Fill Parent.

@internaldoc TODO(hal): Think about generalizing this to include more than text.

Author
halab.nosp@m.elso.nosp@m.n@goo.nosp@m.gle..nosp@m.com (Hal Abelson)
osmid.nosp@m.y@mi.nosp@m.t.edu (Olivier Midy)

Definition at line 64 of file ListView.java.

Constructor & Destructor Documentation

◆ ListView()

com.google.appinventor.components.runtime.ListView.ListView ( ComponentContainer  container)

Creates a new ListView component.

Parameters
containercontainer that the component will be placed in

Definition at line 105 of file ListView.java.

Member Function Documentation

◆ AfterPicking()

void com.google.appinventor.components.runtime.ListView.AfterPicking ( )

Simple event to be raised after the an element has been chosen in the list. The selected element is available in the Selection(String) property.

Definition at line 454 of file ListView.java.

◆ BackgroundColor() [1/2]

int com.google.appinventor.components.runtime.ListView.BackgroundColor ( )

Returns the listview's background color as an alpha-red-green-blue integer, i.e.,

0xAARRGGBB

. An alpha of

00

indicates fully transparent and

FF

means opaque.

Returns
background color in the format 0xAARRGGBB, which includes alpha, red, green, and blue components

Definition at line 483 of file ListView.java.

◆ BackgroundColor() [2/2]

void com.google.appinventor.components.runtime.ListView.BackgroundColor ( int  argb)

The color of the ListView background.

@internaldoc Specifies the ListView's background color as an alpha-red-green-blue integer, i.e.,

0xAARRGGBB

. An alpha of

00

indicates fully transparent and

FF

means opaque.

Parameters
argbbackground color in the format 0xAARRGGBB, which includes alpha, red, green, and blue components

Definition at line 501 of file ListView.java.

◆ Elements() [1/2]

YailList com.google.appinventor.components.runtime.ListView.Elements ( )

Elements property getter method

@suppressdoc

Returns
a YailList representing the list of strings to be picked from

Definition at line 260 of file ListView.java.

◆ Elements() [2/2]

void com.google.appinventor.components.runtime.ListView.Elements ( YailList  itemsList)

Specifies the list of choices to display.

Parameters
itemsLista YailList containing the strings to be added to the ListView

Definition at line 248 of file ListView.java.

◆ ElementsFromString()

void com.google.appinventor.components.runtime.ListView.ElementsFromString ( String  itemstring)

Set the list of choices from a string of comma-separated values.

Parameters
itemstringa string containing a comma-separated list of the strings to be picked from

Definition at line 273 of file ListView.java.

◆ getView()

View com.google.appinventor.components.runtime.ListView.getView ( )

Returns the View that is displayed in the UI.

Reimplemented from com.google.appinventor.components.runtime.AndroidViewComponent.

Definition at line 177 of file ListView.java.

◆ Height()

void com.google.appinventor.components.runtime.ListView.Height ( int  height)

Specifies the type%'s vertical height, measured in pixels.

Parameters
heightfor height length

Reimplemented from com.google.appinventor.components.runtime.AndroidViewComponent.

Definition at line 188 of file ListView.java.

◆ itemsToColoredText()

Spannable [] com.google.appinventor.components.runtime.ListView.itemsToColoredText ( )

Definition at line 292 of file ListView.java.

◆ onItemClick()

void com.google.appinventor.components.runtime.ListView.onItemClick ( AdapterView<?>  parent,
View  view,
int  position,
long  id 
)

Simple event to raise when the component is clicked. Implementation of AdapterView.OnItemClickListener

Definition at line 414 of file ListView.java.

◆ onItemSelected()

void com.google.appinventor.components.runtime.ListView.onItemSelected ( AdapterView<?>  adapterView,
View  view,
int  i,
long  l 
)

Simple event to raise when the component is selected. Implementation of AdapterView.OnItemSelectedListener.

Definition at line 438 of file ListView.java.

◆ onNothingSelected()

void com.google.appinventor.components.runtime.ListView.onNothingSelected ( AdapterView<?>  adapterView)

Definition at line 444 of file ListView.java.

◆ Selection() [1/2]

String com.google.appinventor.components.runtime.ListView.Selection ( )

Returns the text in the ListView at the position of SelectionIndex(int).

Definition at line 361 of file ListView.java.

◆ Selection() [2/2]

void com.google.appinventor.components.runtime.ListView.Selection ( String  value)

Selection property setter method.

@suppressdoc

Definition at line 373 of file ListView.java.

◆ SelectionColor() [1/2]

int com.google.appinventor.components.runtime.ListView.SelectionColor ( )

Returns the listview's selection color as an alpha-red-green-blue integer, i.e.,

0xAARRGGBB

. An alpha of

00

indicates fully transparent and

FF

means opaque. Is not supported on Icecream Sandwich or earlier

Returns
selection color in the format 0xAARRGGBB, which includes alpha, red, green, and blue components

Definition at line 517 of file ListView.java.

◆ SelectionColor() [2/2]

void com.google.appinventor.components.runtime.ListView.SelectionColor ( int  argb)

The color of the item when it is selected.

@internaldoc Specifies the ListView's selection color as an alpha-red-green-blue integer, i.e.,

0xAARRGGBB

. An alpha of

00

indicates fully transparent and

FF

means opaque. Is not supported on Icecream Sandwich or earlier

Parameters
argbselection color in the format 0xAARRGGBB, which includes alpha, red, green, and blue components

Definition at line 536 of file ListView.java.

◆ SelectionIndex() [1/2]

int com.google.appinventor.components.runtime.ListView.SelectionIndex ( )

The index of the currently selected item, starting at 1. If no item is selected, the value will be 0. If an attempt is made to set this to a number less than 1 or greater than the number of items in the ListView, SelectionIndex will be set to 0, and Selection(String) will be set to the empty text.

Definition at line 330 of file ListView.java.

◆ SelectionIndex() [2/2]

void com.google.appinventor.components.runtime.ListView.SelectionIndex ( int  index)

Sets the index to the passed argument for selection

@suppressdoc

Parameters
indexthe index to be selected

Definition at line 347 of file ListView.java.

◆ setAdapterData()

void com.google.appinventor.components.runtime.ListView.setAdapterData ( )

Sets the items of the ListView through an adapter

Definition at line 281 of file ListView.java.

◆ setBackgroundColor()

void com.google.appinventor.components.runtime.ListView.setBackgroundColor ( int  color)

Assigns a value to the backgroundColor

Parameters
coloran alpha-red-green-blue integer for a color

Definition at line 463 of file ListView.java.

◆ ShowFilterBar() [1/2]

boolean com.google.appinventor.components.runtime.ListView.ShowFilterBar ( )

Returns true or false depending on the visibility of the Filter bar element

@suppressdoc

Returns
true or false (visibility)

Definition at line 237 of file ListView.java.

◆ ShowFilterBar() [2/2]

void com.google.appinventor.components.runtime.ListView.ShowFilterBar ( boolean  showFilter)

Sets visibility of the filter bar. true{:.logic.block} will show the bar, false{:.logic.block} will hide it.

Parameters
showFilterset the visibility according to this input

Definition at line 219 of file ListView.java.

◆ TextColor() [1/2]

int com.google.appinventor.components.runtime.ListView.TextColor ( )

Returns the listview's text item color as an alpha-red-green-blue integer, i.e.,

0xAARRGGBB

. An alpha of

00

indicates fully transparent and

FF

means opaque.

Returns
background color in the format 0xAARRGGBB, which includes alpha, red, green, and blue components

Definition at line 554 of file ListView.java.

◆ TextColor() [2/2]

void com.google.appinventor.components.runtime.ListView.TextColor ( int  argb)

The text color of the ListView items.

@internaldoc Specifies the ListView item's text color as an alpha-red-green-blue integer, i.e.,

0xAARRGGBB

. An alpha of

00

indicates fully transparent and

FF

means opaque.

Parameters
argbbackground color in the format 0xAARRGGBB, which includes alpha, red, green, and blue components

Definition at line 572 of file ListView.java.

◆ TextSize() [1/2]

int com.google.appinventor.components.runtime.ListView.TextSize ( )

Returns the listview's text font Size

Returns
text size as an float

Definition at line 585 of file ListView.java.

◆ TextSize() [2/2]

void com.google.appinventor.components.runtime.ListView.TextSize ( int  fontSize)

Specifies the ListView item's text font size

Parameters
integervalue for font size

Definition at line 597 of file ListView.java.

◆ Width()

void com.google.appinventor.components.runtime.ListView.Width ( int  width)

Specifies the horizontal width of the type%, measured in pixels.

Parameters
widthfor width length

Reimplemented from com.google.appinventor.components.runtime.AndroidViewComponent.

Definition at line 202 of file ListView.java.

Member Data Documentation

◆ container

final ComponentContainer com.google.appinventor.components.runtime.ListView.container
protected

Definition at line 71 of file ListView.java.


The documentation for this class was generated from the following file: