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.
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.
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.
Similar to DrawText. Rotates the text before it is drawn.
Initialize (ViewAsB4XView)
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.
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: DimrAsB4XRect = cvs1.MeasureText(Text, Fnt) DimBaseLineAsInt = 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 (WidthAsFloat, HeightAsFloat)
Resizes the canvas.
TargetRectAsB4XRect [read only]
Returns a B4XRect with the same dimensions as the target view.
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 (RectAsB4XRect) AsB4XPath
Initializes the path and sets the current path shape to an oval. Rect - The oval framing rectangle.
Changes the Z order of this view and brings it to the front.
CheckedAsBoolean
Gets or sets the checked state (also named selected or value). Supported types: B4A - CheckBox, RadioButton, ToggleButton, Switch B4i - Switch B4J: CheckBox, RadioButton, ToggleButton.
ColorAsInt
Gets or sets the background color. Returns 0 if the color is not available.
EditTextHintAsString
Gets or sets the hint or prompt text. Supported types: B4A - EditText B4i - TextField B4J - TextArea, TextField
EnabledAsBoolean
Gets or sets whether the view is enabled. Does nothing if the view does not support this property.
FontAsB4XFont
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.
GetAllViewsRecursiveAsIterableList
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: ForEachvAsB4XViewInPanel1.GetAllViewsRecursive ... Next Supported types B4A - Activity, Panel B4i - Panel B4J - Pane
GetView (IndexAsInt) AsB4XView
Returns the view at the given index. Supported types B4A - Activity, Panel B4i - Panel B4J - Pane
Returns the number of direct child views. Supported types B4A - Activity, Panel B4i - Panel B4J - Pane
ParentAsB4XView [read only]
Returns the parent. The object returned will be uninitialized if there is no parent.
ProgressAsInt
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.
Requests focus to be set to this view. Returns True if the focus has shifted. Always returns True in B4J.
RotationAsFloat
Gets or sets the view's rotation transformation (in degrees).
ScrollViewContentHeightAsInt
Gets or set the scroll view inner panel height. Supported types: B4A - HorizontalScrollView, ScrollView B4i - ScrollView B4J - ScrollPane
ScrollViewContentWidthAsInt
Gets or set the scroll view inner panel width. Supported types: B4A - HorizontalScrollView, ScrollView B4i - ScrollView B4J - ScrollPane
ScrollViewInnerPanelAsB4XView [read only]
Gets or sets the scroll view inner panel. Supported types: B4A - HorizontalScrollView, ScrollView B4i - ScrollView B4J - ScrollPane
ScrollViewOffsetXAsInt
Gets or sets the horizontal scroll position. Supported types: B4A - HorizontalScrollView (returns 0 for ScrollView). B4i - ScrollView B4J - ScrollPane
ScrollViewOffsetYAsInt
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 (BitmapAsandroid.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.
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.
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.
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.
TextSizeAsFloat
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.
TopAsInt
Gets or sets the top position.
TOUCH_ACTION_DOWNAsInt
TOUCH_ACTION_MOVEAsInt
Equivalent to MouseDragged in B4J.
TOUCH_ACTION_MOVE_NOTOUCHAsInt
Equivalent to MouseMoved in B4J (will never be raised in B4A or B4i).
Creates a new B4XFont from the given B4XFont and size. Do NOT use DIP units with font sizes.
CreateFontAwesome (SizeAsFloat) AsB4XFont
Creates a new B4XFont based on FontAwesome font.
CreateMaterialIcons (SizeAsFloat) AsB4XFont
Creates a new B4XFont based on Material Icons font.
CreatePanel (EventNameAsString) AsB4XView
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.
DefaultFolderAsString [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_CancelAsInt
DialogResponse_NegativeAsInt
DialogResponse_PositiveAsInt
FileUri (DirAsString, FileNameAsString) AsString
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")}"$)
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: DimsfAsObject = xui.Msgbox2Async("Delete file?", "Title", "Yes", "Cancel", "No", Null) WaitFor (sf) Msgbox_Result (ResultAsInt) IfResult = xui.DialogResponse_PositiveThen Log("Deleted!!!") EndIf
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 (ColorAsObject) AsInt
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.
ScaleAsFloat [read only]
Returns the screen normalized scale. Always returns 1 in B4J and B4i. Returns the same value as 100dip / 100 in B4A.
SetDataFolder (AppNameAsString)
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.