Press on the image to return to the main documentation page.
XUI
List of types:
B4XBitmap
B4XCanvas
B4XFont
B4XPath
B4XRect
B4XView
XUI
B4XBitmap
Represents a loaded image. Similar to B4A Bitmap, B4i Bitmap and B4J Image.
Events:
None
Members:
Crop
(
Left
As
Int
,
Top
As
Int
,
Width
As
Int
,
Height
As
Int
)
As
B4XBitmap
Height
As
Double
[read
only]
IsInitialized
As
Boolean
Resize
(
Width
As
Int
,
Height
As
Int
,
KeepAspectRatio
As
Boolean
)
As
B4XBitmap
Rotate
(
Degrees
As
Int
)
As
B4XBitmap
Scale
As
Float
[read
only]
Width
As
Double
[read
only]
WriteToStream
(
Out
As
java
.
io
.
OutputStream
,
Quality
As
Int
,
Format
As
android
.
graphics
.
Bitmap
.
CompressFormat
)
Members description:
Crop
(
Left
As
Int
,
Top
As
Int
,
Width
As
Int
,
Height
As
Int
)
As
B4XBitmap
Returns a
new
cropped bitmap.
Height
As
Double
[read
only]
Returns the bitmap's height.
IsInitialized
As
Boolean
Resize
(
Width
As
Int
,
Height
As
Int
,
KeepAspectRatio
As
Boolean
)
As
B4XBitmap
Returns a
new
bitmap with the given width and height.
Rotate
(
Degrees
As
Int
)
As
B4XBitmap
Returns a
new
rotated bitmap. The bitmap will be rotated clockwise.
The following values are supported on all three platforms: 0, 90, 180, 270.
Scale
As
Float
[read
only]
Returns the bitmap scale. It will always be 1 in B4J and B4i.
Width
As
Double
[read
only]
Returns the bitmap's width.
WriteToStream
(
Out
As
java
.
io
.
OutputStream
,
Quality
As
Int
,
Format
As
android
.
graphics
.
Bitmap
.
CompressFormat
)
Writes the bitmap to the output stream.
Quality - Value between 0 (smaller size, lower quality) to 100 (larger size, higher quality),
which is a hint for the compressor for the required quality.
Format - JPEG or PNG.
Example:
Dim
Out
As
OutputStream
Out
=
File
.
OpenOutput
(
XUI
.
DefaultFolder
,
"Test.png"
,
False
)
Bitmap1
.
WriteToStream
(
out
,
100
,
"PNG"
)
Out
.
Close
B4XCanvas
A cross platform canvas.
Events:
None
Members:
ClearRect
(
Rect
As
B4XRect
)
ClipPath
(
Path
As
B4XPath
)
CreateBitmap
As
B4XBitmap
DrawBitmap
(
Bitmap
As
android
.
graphics
.
Bitmap
,
Destination
As
B4XRect
)
DrawBitmapRotated
(
Bitmap
As
android
.
graphics
.
Bitmap
,
Destination
As
B4XRect
,
Degrees
As
Float
)
DrawCircle
(
x
As
Float
,
y
As
Float
,
Radius
As
Float
,
Color
As
Int
,
Filled
As
Boolean
,
StrokeWidth
As
Float
)
DrawLine
(
x1
As
Float
,
y1
As
Float
,
x2
As
Float
,
y2
As
Float
,
Color
As
Int
,
StrokeWidth
As
Float
)
DrawPath
(
Path
As
B4XPath
,
Color
As
Int
,
Filled
As
Boolean
,
StrokeWidth
As
Float
)
DrawPathRotated
(
Path
As
B4XPath
,
Color
As
Int
,
Filled
As
Boolean
,
StrokeWidth
As
Float
,
Degrees
As
Float
,
CenterX
As
Float
,
CenterY
As
Float
)
DrawRect
(
Rect
As
B4XRect
,
Color
As
Int
,
Filled
As
Boolean
,
StrokeWidth
As
Float
)
DrawText
(
Text
As
String
,
x
As
Float
,
y
As
Float
,
Font
As
B4XFont
,
Color
As
Int
,
Alignment
As
android
.
graphics
.
Paint
.
Align
)
DrawTextRotated
(
Text
As
String
,
x
As
Float
,
y
As
Float
,
Font
As
B4XFont
,
Color
As
Int
,
Alignment
As
android
.
graphics
.
Paint
.
Align
,
Degree
As
Float
)
Initialize
(
View
As
B4XView
)
Invalidate
MeasureText
(
Text
As
String
,
Font
As
B4XFont
)
As
B4XRect
Release
RemoveClip
Resize
(
Width
As
Float
,
Height
As
Float
)
TargetRect
As
B4XRect
[read
only]
TargetView
As
B4XView
[read
only]
Members description:
ClearRect
(
Rect
As
B4XRect
)
Clears the given rectangle. Does not work in B4J with clipped paths.
ClipPath
(
Path
As
B4XPath
)
Clips the drawings to a closed path.
CreateBitmap
As
B4XBitmap
Returns a copy of the canvas bitmap. In B4A it returns the canvas bitmap itself (not a copy).
DrawBitmap
(
Bitmap
As
android
.
graphics
.
Bitmap
,
Destination
As
B4XRect
)
Draws a bitmap in the given destination. Use B4XBitmap.Crop to draw part of a bitmap.
DrawBitmapRotated
(
Bitmap
As
android
.
graphics
.
Bitmap
,
Destination
As
B4XRect
,
Degrees
As
Float
)
Similar to DrawBitmap. Draws a rotated bitmap.
DrawCircle
(
x
As
Float
,
y
As
Float
,
Radius
As
Float
,
Color
As
Int
,
Filled
As
Boolean
,
StrokeWidth
As
Float
)
Draws a circle.
DrawLine
(
x1
As
Float
,
y1
As
Float
,
x2
As
Float
,
y2
As
Float
,
Color
As
Int
,
StrokeWidth
As
Float
)
Draws a line between x1,y1 to x2,y2.
DrawPath
(
Path
As
B4XPath
,
Color
As
Int
,
Filled
As
Boolean
,
StrokeWidth
As
Float
)
Draws the given path.
Path - Path shape.
Color - Drawing color.
Filled - Whether to fill the shape or not.
StrokeWidth - Stroke width. Only relevant when Filled is False.
Note that there is a subtle difference in the way the stroke width affects the drawing between B4J and the other platforms.
In B4J the path defines the stroke edge. In B4A and B4i it defines the stroke center.
DrawPathRotated
(
Path
As
B4XPath
,
Color
As
Int
,
Filled
As
Boolean
,
StrokeWidth
As
Float
,
Degrees
As
Float
,
CenterX
As
Float
,
CenterY
As
Float
)
Similar to DrawPath. Rotates the path based on the degrees and center parameters.
DrawRect
(
Rect
As
B4XRect
,
Color
As
Int
,
Filled
As
Boolean
,
StrokeWidth
As
Float
)
Draws a rectangle.
DrawText
(
Text
As
String
,
x
As
Float
,
y
As
Float
,
Font
As
B4XFont
,
Color
As
Int
,
Alignment
As
android
.
graphics
.
Paint
.
Align
)
Draws the text.
Text - The text that will be drawn.
x - The origin X coordinate.
y - The origin Y coordinate.
Font - The text font.
Color - Drawing color.
Alignment - Sets the alignment relative to the origin. One of the following values: LEFT, CENTER, RIGHT.
DrawTextRotated
(
Text
As
String
,
x
As
Float
,
y
As
Float
,
Font
As
B4XFont
,
Color
As
Int
,
Alignment
As
android
.
graphics
.
Paint
.
Align
,
Degree
As
Float
)
Similar to DrawText. Rotates the text before it is drawn.
Initialize
(
View
As
B4XView
)
Initializes the canvas.
In B4A and B4i the canvas will draw on the passed view.
In B4J the canvas which is a view by itself is added to the passed pane as the first element.
Invalidate
Commits the drawings. Must be called for the drawings to be updated.
MeasureText
(
Text
As
String
,
Font
As
B4XFont
)
As
B4XRect
Measures single line texts and returns their width, height and the height above the baseline.
-Rect.Top returns the height above the baseline.
Code to draw center aligned text:
Dim
r
As
B4XRect
=
cvs1
.
MeasureText
(
Text
,
Fnt
)
Dim
BaseLine
As
Int
=
CenterY
-
r
.
Height
/
2
-
r
.
Top
cvs1
.
DrawText
(
Text
,
CenterX
,
BaseLine
,
Fnt
,
Clr
,
"CENTER"
)
Release
Releases native resources related to the canvas. Does nothing in B4A and B4J.
RemoveClip
Removes a previously set clip region.
Resize
(
Width
As
Float
,
Height
As
Float
)
Resizes the canvas.
TargetRect
As
B4XRect
[read
only]
Returns a B4XRect with the same dimensions as the target view.
TargetView
As
B4XView
[read
only]
Returns the target view.
B4XFont
An object that holds a typeface and size.
Events:
None
Members:
IsInitialized
As
Boolean
[read
only]
Size
As
Float
[read
only]
ToNativeFont
As
TypefaceWrapper
Members description:
IsInitialized
As
Boolean
[read
only]
Size
As
Float
[read
only]
ToNativeFont
As
TypefaceWrapper
Returns a native font object representing the same font.
B4XPath
Events:
None
Members:
Initialize
(
x
As
Float
,
y
As
Float
)
As
B4XPath
InitializeArc
(
x
As
Float
,
y
As
Float
,
Radius
As
Float
,
StartingAngle
As
Float
,
SweepAngle
As
Float
)
As
B4XPath
InitializeOval
(
Rect
As
B4XRect
)
As
B4XPath
InitializeRoundedRect
(
Rect
As
B4XRect
,
CornersRadius
As
Float
)
As
B4XPath
IsInitialized
As
Boolean
LineTo
(
x
As
Float
,
y
As
Float
)
As
B4XPath
Members description:
Initialize
(
x
As
Float
,
y
As
Float
)
As
B4XPath
Initializes the path and sets the value of the first point.
InitializeArc
(
x
As
Float
,
y
As
Float
,
Radius
As
Float
,
StartingAngle
As
Float
,
SweepAngle
As
Float
)
As
B4XPath
Initializes the path and sets the current path shape to an arc.
x / y - Arc center.
Radius - Arc radius.
StartingAngle - The starting angle. 0 equals to hour 3.
SweepAngle - Sweep angle. Positive = clockwise.
InitializeOval
(
Rect
As
B4XRect
)
As
B4XPath
Initializes the path and sets the current path shape to an oval.
Rect - The oval framing rectangle.
InitializeRoundedRect
(
Rect
As
B4XRect
,
CornersRadius
As
Float
)
As
B4XPath
Initializes the path and sets the current path shape to a rectangle with rounded corners.
Rect - Rectangle.
CornersRadius - Corners radius.
IsInitialized
As
Boolean
LineTo
(
x
As
Float
,
y
As
Float
)
As
B4XPath
Adds a line from the last point to the specified point.
B4XRect
Events:
None
Members:
Bottom
As
Float
CenterX
As
Float
[read
only]
CenterY
As
Float
[read
only]
Height
As
Float
Initialize
(
Left
As
Float
,
Top
As
Float
,
Right
As
Float
,
Bottom
As
Float
)
Left
As
Float
Right
As
Float
Top
As
Float
Width
As
Float
Members description:
Bottom
As
Float
CenterX
As
Float
[read
only]
Returns the horizontal center.
CenterY
As
Float
[read
only]
Returns the vertical center.
Height
As
Float
Gets or sets the rectangle height.
Initialize
(
Left
As
Float
,
Top
As
Float
,
Right
As
Float
,
Bottom
As
Float
)
Left
As
Float
Right
As
Float
Top
As
Float
Width
As
Float
Gets or sets the rectangle width.
B4XView
This is an 'Activity Object', it cannot be declared under Sub Process_Globals.
Events:
None
Members:
AddView
(
View
As
android
.
view
.
View
,
Left
As
Int
,
Top
As
Int
,
Width
As
Int
,
Height
As
Int
)
BringToFront
Checked
As
Boolean
Color
As
Int
EditTextHint
As
String
Enabled
As
Boolean
Font
As
B4XFont
GetAllViewsRecursive
As
IterableList
GetView
(
Index
As
Int
)
As
B4XView
Height
As
Int
IsInitialized
As
Boolean
Left
As
Int
LoadLayout
(
LayoutFile
As
String
)
NumberOfViews
As
Int
[read
only]
Parent
As
B4XView
[read
only]
Progress
As
Int
RemoveAllViews
RemoveViewFromParent
RequestFocus
As
Boolean
Rotation
As
Float
ScrollViewContentHeight
As
Int
ScrollViewContentWidth
As
Int
ScrollViewInnerPanel
As
B4XView
[read
only]
ScrollViewOffsetX
As
Int
ScrollViewOffsetY
As
Int
SendToBack
SetBitmap
(
Bitmap
As
android
.
graphics
.
Bitmap
)
SetColorAndBorder
(
BackgroundColor
As
Int
,
BorderWidth
As
Int
,
BorderColor
As
Int
,
BorderCornerRadius
As
Int
)
SetColorAnimated
(
Duration
As
Int
,
FromColor
As
Int
,
ToColor
As
Int
)
SetLayoutAnimated
(
Duration
As
Int
,
Left
As
Int
,
Top
As
Int
,
Width
As
Int
,
Height
As
Int
)
SetRotationAnimated
(
Duration
As
Int
,
Degree
As
Float
)
SetTextAlignment
(
Vertical
As
String
,
Horizontal
As
String
)
SetTextSizeAnimated
(
Duration
As
Int
,
TextSize
As
Float
)
SetVisibleAnimated
(
Duration
As
Int
,
Visible
As
Boolean
)
Snapshot
As
B4XBitmap
Tag
As
Object
Text
As
String
TextColor
As
Int
TextSize
As
Float
Top
As
Int
TOUCH_ACTION_DOWN
As
Int
TOUCH_ACTION_MOVE
As
Int
TOUCH_ACTION_MOVE_NOTOUCH
As
Int
TOUCH_ACTION_UP
As
Int
Visible
As
Boolean
Width
As
Int
Members description:
AddView
(
View
As
android
.
view
.
View
,
Left
As
Int
,
Top
As
Int
,
Width
As
Int
,
Height
As
Int
)
Adds a view.
Supported types
B4A - Activity, Panel
B4i - Panel
B4J - Pane
BringToFront
Changes the Z order of this view and brings it to the front.
Checked
As
Boolean
Gets or sets the checked state (also named selected or value).
Supported types:
B4A - CheckBox, RadioButton, ToggleButton, Switch
B4i - Switch
B4J: CheckBox, RadioButton, ToggleButton.
Color
As
Int
Gets or sets the background color. Returns 0 if the color is not available.
EditTextHint
As
String
Gets or sets the hint or prompt text. Supported types:
B4A - EditText
B4i - TextField
B4J - TextArea, TextField
Enabled
As
Boolean
Gets or sets whether the view is enabled. Does nothing if the view does not support this property.
Font
As
B4XFont
Gets or sets the font (typeface and text size).
Supported types:
B4A - EditText, Label, Button, CheckBox, RadioButton, ToggleButton
B4i - TextField, TextView, Button, Label
B4J - Sets the Font property if available. Otherwise sets the CSS attribute.
GetAllViewsRecursive
As
IterableList
Returns an iterator that iterates over all the child views including views that were added to other child views.
Make sure to check the view type as it might return subviews as well.
Example:
For
Each
v
As
B4XView
In
Panel1
.
GetAllViewsRecursive
...
Next
Supported types
B4A - Activity, Panel
B4i - Panel
B4J - Pane
GetView
(
Index
As
Int
)
As
B4XView
Returns the view at the given index.
Supported types
B4A - Activity, Panel
B4i - Panel
B4J - Pane
Height
As
Int
Gets or sets the view's height.
IsInitialized
As
Boolean
Left
As
Int
Gets or sets the left position.
LoadLayout
(
LayoutFile
As
String
)
Loads the layout file.
Supported types
B4A - Panel
B4i - Panel
B4J - Pane
NumberOfViews
As
Int
[read
only]
Returns the number of direct child views.
Supported types
B4A - Activity, Panel
B4i - Panel
B4J - Pane
Parent
As
B4XView
[read
only]
Returns the parent. The object returned will be uninitialized if there is no parent.
Progress
As
Int
Gets or sets the progress value. The progress value is scaled between 0 to 100 (this is different than the native views range in B4J and B4i).
Supported types:
B4A - ProgressBar
B4J - ProgressView, ProgressIndicator
B4i - ProgressView
Value should be between 0 to 100.
RemoveAllViews
Removes all views.
Supported types
B4A - Activity, Panel
B4i - Panel
B4J - Pane
RemoveViewFromParent
Removes the view from its parent.
RequestFocus
As
Boolean
Requests focus to be set to this view. Returns True if the focus has shifted.
Always returns True in B4J.
Rotation
As
Float
Gets or sets the view's rotation transformation (in degrees).
ScrollViewContentHeight
As
Int
Gets or set the scroll view inner panel height.
Supported types:
B4A - HorizontalScrollView, ScrollView
B4i - ScrollView
B4J - ScrollPane
ScrollViewContentWidth
As
Int
Gets or set the scroll view inner panel width.
Supported types:
B4A - HorizontalScrollView, ScrollView
B4i - ScrollView
B4J - ScrollPane
ScrollViewInnerPanel
As
B4XView
[read
only]
Gets or sets the scroll view inner panel.
Supported types:
B4A - HorizontalScrollView, ScrollView
B4i - ScrollView
B4J - ScrollPane
ScrollViewOffsetX
As
Int
Gets or sets the horizontal scroll position.
Supported types:
B4A - HorizontalScrollView (returns 0 for ScrollView).
B4i - ScrollView
B4J - ScrollPane
ScrollViewOffsetY
As
Int
Gets or sets the vertical scroll position.
Supported types:
B4A - ScrollView (returns 0 for HorizontalScrollView).
B4i - ScrollView
B4J - ScrollPane
SendToBack
Changes the Z order of this view and sends it to the back.
SetBitmap
(
Bitmap
As
android
.
graphics
.
Bitmap
)
Sets the view's bitmap.
Supported types:
B4A - All views. The view's Drawable will be set to a BitmapDrawable with Gravity set to CENTER.
B4i - ImageView. ContentMode set to Fit.
B4J - ImageView. PreserveRatio is set to True.
SetColorAndBorder
(
BackgroundColor
As
Int
,
BorderWidth
As
Int
,
BorderColor
As
Int
,
BorderCornerRadius
As
Int
)
Sets the background color and border.
B4A - The view's drawable will be set to ColorDrawable.
SetColorAnimated
(
Duration
As
Int
,
FromColor
As
Int
,
ToColor
As
Int
)
Changes the background color with a transition animation between the FromColor and the ToColor colors.
Duration - Animation duration measured in milliseconds.
Note that the animation does not work with labels in B4i. It will change immediately.
You can put a transparent label inside a panel and animate the panel color instead.
SetLayoutAnimated
(
Duration
As
Int
,
Left
As
Int
,
Top
As
Int
,
Width
As
Int
,
Height
As
Int
)
Sets the view size and position.
Duration - Animation duration in milliseconds. Pass 0 to make the change immediately.
SetRotationAnimated
(
Duration
As
Int
,
Degree
As
Float
)
Rotates the view with animation.
Duration - Animation duration in milliseconds.
Degree - Rotation degree.
SetTextAlignment
(
Vertical
As
String
,
Horizontal
As
String
)
Sets the text alignment.
Vertical - TOP, CENTER or BOTTOM.
Horizontal - LEFT, CENTER or RIGHT.
In B4i the vertical alignment has no effect.
Supported types:
B4A - EditText, Label, Button, CheckBox, RadioButton, ToggleButton
B4J - Label, Button, Checkbox, RadioButton, ToggleButton
SetTextSizeAnimated
(
Duration
As
Int
,
TextSize
As
Float
)
Sets the text size.
Supported types:
B4A - EditText, Label, Button, CheckBox, RadioButton, ToggleButton
B4i - TextField, TextView, Button, Label.
Only labels are animated.
B4J - Sets the TextSize property if available and the CSS attribute for other types.
SetVisibleAnimated
(
Duration
As
Int
,
Visible
As
Boolean
)
Fades in or fades out the view.
Snapshot
As
B4XBitmap
Captures the views appearance.
Tag
As
Object
Gets or sets the view's tag object.
Text
As
String
Gets or sets the text. Supported types:
B4A - EditText, Label, Button, CheckBox, RadioButton, ToggleButton
B4i - TextField, TextView, Button, Label
B4J - TextField, TextArea, Label, Button, CheckBox, RadioButton, ToggleButton
TextColor
As
Int
Gets or sets the text colors. Supported types:
B4A - EditText, Label, Button, CheckBox, RadioButton, ToggleButton
B4i - TextField, TextView, Label
B4J - All types. Based on the native TextColor property if available or -fx-text-fill CSS attribute.
TextSize
As
Float
Gets or sets the text size.
Supported types:
B4A - EditText, Label, Button, CheckBox, RadioButton, ToggleButton
B4i - TextField, TextView, Button, Label
B4J - Returns the TextSize property if available and the CSS attribute for other types. Returns 0 if attribute not available.
Top
As
Int
Gets or sets the top position.
TOUCH_ACTION_DOWN
As
Int
TOUCH_ACTION_MOVE
As
Int
Equivalent to MouseDragged in B4J.
TOUCH_ACTION_MOVE_NOTOUCH
As
Int
Equivalent to MouseMoved in B4J (will never be raised in B4A or B4i).
TOUCH_ACTION_UP
As
Int
Visible
As
Boolean
Gets or sets whether the view is visible.
Width
As
Int
Gets or sets the view's width.
XUI
The XUI object includes various methods and utilities.
Events:
None
Members:
Color_ARGB
(
Alpha
As
Int
,
R
As
Int
,
G
As
Int
,
B
As
Int
)
As
Int
Color_Black
As
Int
Color_Blue
As
Int
Color_Cyan
As
Int
Color_DarkGray
As
Int
Color_Gray
As
Int
Color_Green
As
Int
Color_LightGray
As
Int
Color_Magenta
As
Int
Color_Red
As
Int
Color_RGB
(
R
As
Int
,
G
As
Int
,
B
As
Int
)
As
Int
Color_Transparent
As
Int
Color_White
As
Int
Color_Yellow
As
Int
CreateDefaultBoldFont
(
Size
As
Float
)
As
B4XFont
CreateDefaultFont
(
Size
As
Float
)
As
B4XFont
CreateFont
(
Typeface
As
android
.
graphics
.
Typeface
,
Size
As
Float
)
As
B4XFont
CreateFont2
(
B4XFont
As
B4XFont
,
Size
As
Float
)
As
B4XFont
CreateFontAwesome
(
Size
As
Float
)
As
B4XFont
CreateMaterialIcons
(
Size
As
Float
)
As
B4XFont
CreatePanel
(
EventName
As
String
)
As
B4XView
DefaultFolder
As
String
[read
only]
DialogResponse_Cancel
As
Int
DialogResponse_Negative
As
Int
DialogResponse_Positive
As
Int
FileUri
(
Dir
As
String
,
FileName
As
String
)
As
String
IsB4A
As
Boolean
[read
only]
IsB4i
As
Boolean
[read
only]
IsB4J
As
Boolean
[read
only]
LoadBitmap
(
Dir
As
String
,
FileName
As
String
)
As
B4XBitmap
LoadBitmapResize
(
Dir
As
String
,
FileName
As
String
,
Width
As
Int
,
Height
As
Int
,
KeepAspectRatio
As
Boolean
)
As
B4XBitmap
Msgbox2Async
(
Message
As
CharSequence
,
Title
As
CharSequence
,
Positive
As
String
,
Cancel
As
String
,
Negative
As
String
,
Icon
As
BitmapWrapper
)
As
Object
MsgboxAsync
(
Message
As
CharSequence
,
Title
As
CharSequence
)
As
Object
PaintOrColorToColor
(
Color
As
Object
)
As
Int
Scale
As
Float
[read
only]
SetDataFolder
(
AppName
As
String
)
SubExists
(
Component
As
Object
,
Sub
As
String
,
NotUsed
As
Int
)
As
Boolean
Members description:
Color_ARGB
(
Alpha
As
Int
,
R
As
Int
,
G
As
Int
,
B
As
Int
)
As
Int
Returns the color value from the components. Values should be between 0 to 255.
Color_Black
As
Int
Color_Blue
As
Int
Color_Cyan
As
Int
Color_DarkGray
As
Int
Color_Gray
As
Int
Color_Green
As
Int
Color_LightGray
As
Int
Color_Magenta
As
Int
Color_Red
As
Int
Color_RGB
(
R
As
Int
,
G
As
Int
,
B
As
Int
)
As
Int
Returns the color value from the components. Values should be between 0 to 255.
Color_Transparent
As
Int
Color_White
As
Int
Color_Yellow
As
Int
CreateDefaultBoldFont
(
Size
As
Float
)
As
B4XFont
Create a new B4XFont with the default bold typeface.
Do NOT use DIP units with font sizes.
CreateDefaultFont
(
Size
As
Float
)
As
B4XFont
Create a new B4XFont with the default typeface.
Do NOT use DIP units with font sizes.
CreateFont
(
Typeface
As
android
.
graphics
.
Typeface
,
Size
As
Float
)
As
B4XFont
Creates a new B4XFont from the given font and size.
Do NOT use DIP units with font sizes.
CreateFont2
(
B4XFont
As
B4XFont
,
Size
As
Float
)
As
B4XFont
Creates a new B4XFont from the given B4XFont and size.
Do NOT use DIP units with font sizes.
CreateFontAwesome
(
Size
As
Float
)
As
B4XFont
Creates a new B4XFont based on FontAwesome font.
CreateMaterialIcons
(
Size
As
Float
)
As
B4XFont
Creates a new B4XFont based on Material Icons font.
CreatePanel
(
EventName
As
String
)
As
B4XView
Creates a Panel (or Pane in B4J).
Note that the panel created will clip its child views.
In B4A, this method can only be called from an Activity context.
DefaultFolder
As
String
[read
only]
B4A - Same as File.DirInternal.
B4i - Same as File.DirDocuments.
B4J - Same as File.DirData. You must first call SetDataFolder once before you can use this folder.
DialogResponse_Cancel
As
Int
DialogResponse_Negative
As
Int
DialogResponse_Positive
As
Int
FileUri
(
Dir
As
String
,
FileName
As
String
)
As
String
Returns a file uri. This can be used with WebView to access local resources.
The FileName parameter will be url encoded.
Example:
WebView1
.
LoadHtml
(
$"<img src="$
{
xui
.
FileUri
(
File
.
DirAssets
,
"smiley.png"
)
}" />"$
)
'or:
WebView1
.
LoadUrl
(
$"${
xui
.
FileUri
(
File
.
DirAssets
,
"smiley.png"
)
}"$
)
IsB4A
As
Boolean
[read
only]
Returns True in B4A.
IsB4i
As
Boolean
[read
only]
Returns True in B4i.
IsB4J
As
Boolean
[read
only]
Returns True in B4J.
LoadBitmap
(
Dir
As
String
,
FileName
As
String
)
As
B4XBitmap
Loads a bitmap. In most cases you should use LoadBitmapResize instead.
LoadBitmapResize
(
Dir
As
String
,
FileName
As
String
,
Width
As
Int
,
Height
As
Int
,
KeepAspectRatio
As
Boolean
)
As
B4XBitmap
Loads and resizes a bitmap.
Msgbox2Async
(
Message
As
CharSequence
,
Title
As
CharSequence
,
Positive
As
String
,
Cancel
As
String
,
Negative
As
String
,
Icon
As
BitmapWrapper
)
As
Object
Shows a non-modal Msgbox.
Returns an object that can be used as the sender filter parameter for the Msgbox_Result event.
Message - Dialog message.
Title - Dialog title.
Positive - Positive button text. Pass an empty string to remove button.
Cancel - Cancel button text. Pass an empty string to remove button.
Negative - Negative button text. Pass an empty string to remove button.
Icon - Dialog icon. Pass Null to remove. Does nothing in B4i.
Example:
Dim
sf
As
Object
=
xui
.
Msgbox2Async
(
"Delete file?"
,
"Title"
,
"Yes"
,
"Cancel"
,
"No"
,
Null
)
Wait
For
(
sf
)
Msgbox_Result
(
Result
As
Int
)
If
Result
=
xui
.
DialogResponse_Positive
Then
Log
(
"Deleted!!!"
)
End
If
MsgboxAsync
(
Message
As
CharSequence
,
Title
As
CharSequence
)
As
Object
Shows a non-modal Msgbox.
Returns an object that can be used as the sender filter parameter for the optional Msgbox_Result event.
Example:
xui
.
MsgboxAsync
(
"Hello"
,
"World"
)
PaintOrColorToColor
(
Color
As
Object
)
As
Int
B4A, B4i - Does nothing.
B4J - Converts a Paint object to an Int color. Does not do anything if the color is already an Int color.
Scale
As
Float
[read
only]
Returns the screen normalized scale.
Always returns 1 in B4J and B4i.
Returns the same value as 100dip / 100 in B4A.
SetDataFolder
(
AppName
As
String
)
B4A, B4i - Does nothing.
B4J - Sets the subfolder name on Windows. The actual path will be similar to: C:\Users\[user name]\AppData\Roaming\[AppName].
Does nothing on other platforms.
SubExists
(
Component
As
Object
,
Sub
As
String
,
NotUsed
As
Int
)
As
Boolean
Same as SubExists keyword. Adds an additional parameter that is required in B4i (number of parameters).
Top