Returns a List object.
For more information in the detailed docs see CreateList
Example - Simple
function OnStart()
{
lay = app.CreateLayout( "Linear", "VCenter,FillXY" );
lst = app.CreateList( "Fred,Bill,Jim", 0.8, 0.4 );
lst.SetOnTouch( lst_OnTouch );
lst.SetOnLongTouch( lst_OnLongTouch );
lay.AddChild( lst );
app.AddLayout( lay );
}
function lst_OnTouch( title, body, type, index )
{
app.ShowPopup( "Item = " + title + ", Index = " + index, "Short" );
}
function lst_OnLongTouch()
{
app.ShowPopup( "Long Touch Item = " + title + ", Index = " + index, "Short" );
}
Example - Gray on White
function OnStart()
{
lay = app.CreateLayout( "Linear", "VCenter,FillXY" );
lst = app.CreateList( "Fred,Bill,Jim", 0.8, 0.4 );
lst.SetTextColor( "#ff666666" );
lst.SetBackColor( "#ffffffff" );
lst.SetOnTouch( lst_OnTouch );
lay.AddChild( lst );
app.AddLayout( lay );
}
function lst_OnTouch( title, body, type, index )
{
app.ShowPopup( "Touched Item = " + title );
}
Example - Title + Icon
function OnStart()
{
lay = app.CreateLayout( "Linear", "VCenter,FillXY" );
var data = "Folder:folder,Audio:audio,Photo:photo,Video:video";
lst = app.CreateList( data, 0.8, 0.4 );
lst.SetOnTouch( lst_OnTouch );
lay.AddChild( lst );
app.AddLayout( lay );
}
function lst_OnTouch( title, body, type, index )
{
app.ShowPopup( "Touched Item = " + title );
}
Example - Title + Body
function OnStart()
{
lay = app.CreateLayout( "Linear", "VCenter,FillXY" );
var data = "The Hobbit:Author^c^ J.R.R. Tolkien:null";
data += ",Watership Down:Author^c^ Richard Adams:null";
lst = app.CreateList( data, 0.8, 0.4 );
lst.SetOnTouch( lst_OnTouch );
lay.AddChild( lst );
app.AddLayout( lay );
}
function lst_OnTouch( title, body, type, index )
{
app.ShowPopup( "Touched Item = " + title );
}
Example - Orange Buttons
function OnStart()
{
lay = app.CreateLayout( "Linear", "VCenter,FillXY" );
var data = "Button 1,Button 2,Button 3,Button 4";
lst = app.CreateList( data, 0.8, 0.8, "OrangeButton" );
lst.SetBackColor( "#ffffff" );
lst.SetPadding( 0.1, 0.1, 0.1, 0.1 );
lst.SetOnTouch( lst_OnTouch );
lay.AddChild( lst );
app.AddLayout( lay );
}
function lst_OnTouch( title, body, type, index )
{
app.ShowPopup( "Touched Item = " + title );
}
Example - Gradient Background
function OnStart()
{
lay = app.CreateLayout( "Linear", "VCenter,FillXY" );
var data = "";
for( var i=1; i<=30; i++)
{
if( i>1 ) data += ",";
data += "Item "+i+":Details for item "+i+":null";
}
lst = app.CreateList( data, 1, 1, "WhiteGrad" );
lst.SetTextColor1( "#ff555558");
lst.SetTextColor2( "#ff555558" );
lst.SetTextMargins( 0.04, 0, 0, 0 );
lst.SetOnTouch( lst_OnTouch );
lay.AddChild( lst );
app.AddLayout( lay );
}
function lst_OnTouch( title, body, type, index )
{
app.ShowPopup( "Touched Item = " + title );
}
The following methods are available on the List object:
string
number: fraction of screen width
number: fraction of screen height
string: "WhiteGrad" or "AlumButton" or "GreenButton" or "OrangeButton" or "html" or "FontAwesome"
string: path to file or folder ( "/absolute/..." or "relative/..." )
number: -180..180
number: -100..100
number: 100..100
number: 0..100
Adjust the visual color effect of the control by setting the Hue (by angle in degrees in a color circle), the saturation, brightness and contrast of the control.
Removes the focus of the control so that the user no longer has immediate access to it.
Set the focus to the control so that the user can interact with it immediately.
Get the absolute height of the control in pixels.
string: "" or "px"
Get the height of the control as screen height relative float or in pixels with the px option.
get item data by title
number: integer
GetItemByIndex
string: "" or "px"
Get the distance from the control to the left parent border as width relative float or in pixels with the px option.
GetLength
get full list data
Returns the parent control object where the object was added to - commonly a layout.
number
string: "screen", "px"
Returns data about the position and size of the control.
If the screen option is given the position on the screen will be returned. Otherwise relative to the parent control.
The px options turns the relative values into pixels.
string: "" or "px"
Returns the current size of the contained text. If the px option is given the size will be retured in pixels.
string: "" or "px"
Get the distance from the control to the upper parent border as height relative float or in pixels with the px option.
Returns the control class name.
Returns the current visibility state of the control. The Values are:
Show: visible
Hide: invisible but still consuming space
Gone: invisible and not consuming space
Hides the control without consuming any more layout space as if it were never there.
InsertItem
Returns whether the control is currently useable by the user.
app object
Returns whether the control overlaps with another by a given distance.
Returns whether the control is currently visible to the user, ignoring overlaying controls.
string: comma separated: "boolean", "char", "byte", "short", "int", "long", "float", "double"
Allows access to other functions defined on the object in Java via reflection.
RemoveAll
RemoveItem
RemoveItemByIndex
ScrollToItem
ScrollToItemByIndex
boolean
SelectItem
SelectItemByIndex
number: 0..0.99 or 1..256
Set the transparency of the background by an alpha value between 0 (no transparency) and 0.99 (full transparent) or 1 (no transparency) and 256 (full transparent)
string:
hexadecimal: "#rrggbb", "#aarrggbb"
colourName: "red", "green", ...
Changes the background color of the control.
unknown
string: "left-right" or "right-left" or "top-bottom" or "bottom-top"
Define the background color of the control with a gradient. The default gradient direction is from top to bottom, but you can change it from left to right and the reversed versions of course.
Define a radial color gradient for the background of control.
string: "repeat"
Changes the background to an image which can be repeated using the repeat option.
An image which is often used with that option is '/res/drawable/pattern_carbon' - try it out!
string: "Add" or "Multiply" or "clear" or "darken" or "lighten" or "overlay" or "screen" or "xor" or "src_in" or "src_out" or "src_atop" or "src_over" or "dst_in" or "dst_out" or "dst_atop" or "dst_over"
Adjust the visual color effect with a colour and a given BlendMode. More information about BlendMode can be foind in the
Android Developer page.
string: "start" or "end"
Will cause the inner text to be broken with ... at the start or the end if it cannot fit in the control.
string: "start" or "end"
Will cause the element titles to be broken with ... at the start or the end if it cannot fit in the control.
string: "start" or "end"
Will cause the element bodys to be broken with ... at the start or the end if it cannot fit in the control.
En/Disable the control physically and visually so that the user can/can not access the control. Events like OnTouch will still be fired.
Change the font style by defining a font file.
?
?
icon borders
SetIconSize
SetItem
SetItemByIndex
string: comma separated
SetList
string: "" or "px" or "sp" or "dip" or "mm" or "pt"
Define a distance to other controls on each side of the control.
callen when object long pressed
function()
Define a callback function that is called when the user touches the control.
string: "" or "px" or "sp" or "dip" or "mm" or "pt"
Define distances that elements within the control are to maintain from the control borders.
string: "" or "px"
Defines the position and size for the control if the parent is an absolute layout.
number: factor
Scales the control along with its contents by the factors passed to the function.
string: "" or "spx"
Change the size of the control in either screen relative values or in pixels if the px option was given.
Change the TextColor of the contained text.
?
?
change position from current
Define a shadow displayed around the control.
The sun is always shining so there has to be one. Always.
number: angle in degrees ( 0 - 360 )
?
?
string: "px" or "dip" or "sp" or "mm" or "pt" or "pl" or "ps"
Change the size of the contained text.
?
?
string: "Show" or "Hide" or "Gone"
Change the visibility of the control to one of the available modes:
Show: visible
Hide: invisible but still consuming space
Gone: invisible and not consuming space
Set the visibility of the control to "Show".
object: {
x,
y,
sw,
sh,
rot}
number: milliseconds
string: "Linear.None" or "Quadratic.In/Out" or "Cubic.In/Out" or "Quartic.In/Out" or "Quintic.In/Out" or "Sinusoidal.In/Out" or "Exponential.In/Out" or "Circular.In/Out" or "Elastic.In/Out" or "Back.In/Out" or "Bounce.In/Out"
function()
Performs an animation on the control.
The target object is for the position, size and rotation that the control has at the end of the animation.
The type specifies the behavior and the speed of the animation. Separated by a dot, you must also specify whether you want to apply this behavior to the beginning (In), end (Out), or to both (InOut) times of the animation.
With the amount of repeats you can control how many times you want to play the animation.
If you have jojo activated, the animation will alternate between forward and backward playback, so that if the repetition value is odd, the control will be at the start position again at the end of the animation.
Finally the callback function will be called after the animation has finished. Well, it's about time!