Skip to content

Screen

Category Requires Version
Layout > General API 21, Android 5.0 Lollipop 44

Overview

Top-level component containing all other components in the program.

Permissions

Screen is the top-most component in any app. All the other components are placed on a Screen.

If you take the app as a book, the Screens can be regarded as the pages of a book and the other components as the various elements present on a page of a book, text, images etc.

screen-book-analogy

Screen <--> Book

Events

Back Pressed

Device back button pressed.

whenScreen.Back Presseddo

Error Occurred

Event raised when an error occurs. Only some errors will raise this condition. For those errors, the system will show a notification by default. You can use this event handler to prescribe an error behavior different than the default.

whenScreen.Error Occurred component function Name error Number message do
Params
component Component
function Name Text
error Number Number
message Text

Got Received Shared

Event to detect that a user shared content to your app throw the sharing dialog of any other app. Type stand for integer. 0 = nothing shared, 1 = audio, 2 = image, 3 = text or 4 = video

whenScreen.Got Received Shared type value do
Params
type Number
value Text

Initialize

Screen starting

whenScreen.Initializedo

Keyboard Visibility Changed

Event will be invoked if the keyboard was visible or invisible.

whenScreen.Keyboard Visibility Changed is Keyboard Visible do
Params
is Keyboard Visible Boolean

Event to detect when the menu has loaded. Set here your blocks like TitleBarIcon or AddMenuItem.

whenScreen.Menu Initializedo

Event to detect when a menu item has been selected.

whenScreen.Menu Item Selected menu Item do
Params
menu Item Text

On App Pause

The system calls this method as the first indication that the user is leaving your activity (though it does not always mean the activity is being destroyed).

whenScreen.On App Pausedo

On App Resume

When the activity enters the Resumed state, it comes to the foreground, and then the system invokes this event.

whenScreen.On App Resumedo

On App Stop

When your activity is no longer visible to the user, it has entered the Stopped state, and the system invokes this event.

whenScreen.On App Stopdo

Other Screen Closed

Event raised when another screen has closed and control has returned to this screen.

whenScreen.Other Screen Closed other Screen Name result do
Params
other Screen Name Text
result Any

Permission Denied

Event to handle when the app user has denied a needed permission.

whenScreen.Permission Denied component function Name permission Name do
Params
component Component
function Name Text
permission Name Text

Permission Granted

Event to handle when the app user has granted a needed permission. This event is only run when permission isgranted in response to the AskForPermission method.

whenScreen.Permission Granted permission Name do
Params
permission Name Text

Screen Orientation Changed

Screen orientation changed

whenScreen.Screen Orientation Changeddo

Side Menu Closed

Event will be invoked if the side menu was closed.

whenScreen.Side Menu Closeddo

Side Menu Opened

Event will be invoked if the side menu was opened.

whenScreen.Side Menu Openeddo

Title Bar Back Button Clicked

Event to detect when a menu item has been selected.

whenScreen.Title Bar Back Button Clickeddo

Title Bar Icon Selected

The event returns the 'icon' or 'name' of the selected icon.

whenScreen.Title Bar Icon Selected icon name do
Params
icon Text
name Text

Methods

Add Menu Item

Add a new item to the menu. Use the 'make a list' block.

callScreen.Add Menu Itemmenu Item
Params
menu Item List

Add Menu Item With Icon

Add a new item with a icon on the left side to the menu. This function does not use the make a list block. If you want more items with icon then use this block again.

callScreen.Add Menu Item With Iconmenu Itemmenu Icon
Params
menu Item Text
menu Icon Text

Add Title Bar Icon

Add a new action icon to the TitleBar. You will see a toast message on a long click with your choosen name. Add this block to the "MenuInitialize" event.

callScreen.Add Title Bar Iconiconname
Params
icon Text
name Text

Are Permissions Granted

Returns: Boolean

Returns true if ALL needed app permissions were granted, else false.

callScreen.Are Permissions Granted

Ask For Permission

Ask the user to grant access to a dangerous permission.

callScreen.Ask For Permissionpermission Name
Params
permission Name Text

Can Write System Settings

Returns: Boolean

Returns true if the app can write system settings, else it returns false. It will return true automatic for devices with android version below 6 (API 23).

callScreen.Can Write System Settings

Hide Keyboard

Hide the keyboard.

callScreen.Hide Keyboard

Lock Side Menu

Use this block to lock the side menu. This means the user can not open the side menu until the side menu unlock block is used.

callScreen.Lock Side Menu

Move Task To Back

Move task to back. That means it will minimize your current app.

callScreen.Move Task To Back

Open App Settings

Opens the settings screen of the app. Useful if 'Are Permissions Granted' has returned false.

callScreen.Open App Settings

Open System Write Settings

Opens the app's system settings page. This works only for devices with android 6+.

callScreen.Open System Write Settings

Remove Side Menu

Remove a first created side menu. This block will be usefull if you need to update a side menu dynamically. You can use this block too to test a side menu in the companion. Add then this block above of the 'Side Menu' block.

callScreen.Remove Side Menu

Remove Title Bar Icons

Remove all added action icons from the TitleBar.

callScreen.Remove Title Bar Icons

Reset Options Menu

Reset the menu back to its default

callScreen.Reset Options Menu

Show About Application

Show the dialog which shows when pressing the "About This Application" button in the menu.

callScreen.Show About Application

Show Keyboard

Show the keyboard

callScreen.Show Keyboard

Side Menu

Create a Side Menu. Set to "layout" your layout that will be then your side menu. Use as example a vertical arrangement. Your choosen layout will be then removed from the screen and only visible in the side menu."Information": This block works on companion only if you add a side menu on button click.Don’t add it in companion on "screen initialize event". Else the companion will crash.Do NOT use this block with the Side Menu Layout component

callScreen.Side Menulayout
Params
layout Component

Side Menu Close

If you had set your side menu then you can use this block to close it as example with a button click.

callScreen.Side Menu Close

Side Menu Open

If you had set your side menu then you can use this block to open it as example with a button click.

callScreen.Side Menu Open

Task Description

Sets information describing the task with this activity for presentation inside the Recents System UI. You will see the settings if the device API is >= 21 and you minimize the app.

callScreen.Task Descriptiontextcolor
Params
text Text
color Number

Unlock Side Menu

Use this block to unlock the side menu. This means the user can now open again the side menu.

callScreen.Unlock Side Menu

Version Code

Returns: Number

This block will returns the version code

callScreen.Version Code

Version Name

Returns: Text

This block will returns the version name

callScreen.Version Name

Properties

About Screen

Text ➖ Read Write - Designer Blocks

Information about the screen. It appears when "About this Application" is selected from the system menu. Use it to inform people about your app. In multiple screen apps, each screen has its own AboutScreen info.

Screen.About Screen
setScreen.About Screen to 

About Screen Background Color

Color Default: #444444FF  ➖ Read Write - Designer Blocks

Property for AboutScreenBackgroundColor

Screen.About Screen Background Color
setScreen.About Screen Background Color to 

About Screen Light Theme

Boolean Default: False ➖ Read Write - Designer Blocks

Property for AboutScreenLightTheme

Screen.About Screen Light Theme
setScreen.About Screen Light Theme to 

About Screen Title

Text Default: About this application ➖ Write - Designer Blocks

Define the title of the about application option.

setScreen.About Screen Title to 

Accent Color

Color Default: #FF4081FF  ➖ Write - Designer

This is the accent color used for highlights and other user interface accents.

Accepted Shared File Types

Text ➖ Write - Designer

Property for ReceiveSharedText

Align Horizontal

Number Default: 1 ➖ Read Write - Designer Blocks

A number that encodes how contents of the screen are aligned horizontally. The choices are: 1 = left aligned, 3 = horizontally centered, 2 = right aligned.

Screen.Align Horizontal
setScreen.Align Horizontal to 

Align Vertical

Number Default: 1 ➖ Read Write - Designer Blocks

A number that encodes how the contents of the arrangement are aligned vertically. The choices are: 1 = aligned at the top, 2 = vertically centered, 3 = aligned at the bottom. Vertical alignment has no effect if the screen is scrollable.

Screen.Align Vertical
setScreen.Align Vertical to 

App ID

Text ➖ Write - Designer

The unique APP_ID for the user (which is generated by GWT and stored in Datastore)

App Name

Text ➖ Write - Designer

This is the display name of the installed application in the phone.If the AppName is blank, it will be set to the name of the project when the project is built.

Background Color

Color Default: #FFFFFFFF  ➖ Read Write - Designer Blocks

BackgroundColor property getter method.

Screen.Background Color
setScreen.Background Color to 

Background Image

Text ➖ Read Write - Designer Blocks

The screen background image.

Screen.Background Image
setScreen.Background Image to 

Close Screen Animation

Text Default: default ➖ Read Write - Designer Blocks

The animation for closing current screen and returning to the previous screen. Valid options are default, fade, zoom, slidehorizontal, slidevertical, and none

Screen.Close Screen Animation
setScreen.Close Screen Animation to 

Default File Scope

Com.google.appinventor.components.common.filescopeenum Default: App ➖ Write - Designer

Specifies the default scope used when components access files. Note that the

Drawer Arrow Icon Color

Number ➖ Read Write - Blocks

Set the drawer arrow icon color.

Screen.Drawer Arrow Icon Color
setScreen.Drawer Arrow Icon Color to 

Height

Number ➖ Read - Blocks

Screen height (y-size).

Screen.Height

High Quality Images

Available as Advanced Property

Boolean Default: False ➖ Read Write - Designer Blocks

If set to true, pictures will be loaded in high quality.

Screen.High Quality Images
setScreen.High Quality Images to 

Icon

Text ➖ Write - Designer

Specifies the name of the application icon.

Is Companion

Boolean ➖ Read - Blocks

This block will return true, if you are running your project current in the companion application. Else it will return false.

Screen.Is Companion

is Keyboard Visible

Boolean ➖ Read - Blocks

Returns the status of the keyboard. If the keyboard is visible then the result is true.

Screen.is Keyboard Visible

is Side Menu Added

Boolean ➖ Read - Blocks

Returns true if a side menu is added to the screen.

Screen.is Side Menu Added

is Side Menu Open

Boolean ➖ Read - Blocks

Returns true if a side menu is current open. Else it will return false.

Screen.is Side Menu Open

Keep Screen On

Available as Advanced Property

Boolean Default: False ➖ Read Write - Designer Blocks

Keep the device's screen turned on and bright.

Screen.Keep Screen On
setScreen.Keep Screen On to 

Minimum SDK Level

Available as Advanced Property

Number Default: 21 ➖ Write - Designer

Property for MinSdk

Color Default: #000000FF  ➖ Read Write - Designer Blocks

Set navigation bar color. This will work starting from API Level 21 (Android Lollipop)

Screen.Navigation Bar Color
setScreen.Navigation Bar Color to 

Boolean ➖ Read Write - Blocks

This option tells the system to use dark navigation bar icons, useful for lighter colored navigation bars. Works only for devices with API >= 26.

Screen.Navigation Bar Light Icons
setScreen.Navigation Bar Light Icons to 

Number ➖ Read Write - Blocks

Set the navigation icon color.

Screen.Navigation Icon Color
setScreen.Navigation Icon Color to 

Open Screen Animation

Text Default: default ➖ Read Write - Designer Blocks

The animation for switching to another screen. Valid options are default, fade, zoom, slidehorizontal, slidevertical, and none

Screen.Open Screen Animation
setScreen.Open Screen Animation to 

Options Menu Icon Color

Number ➖ Read Write - Blocks

Set the options menu icon color.

Screen.Options Menu Icon Color
setScreen.Options Menu Icon Color to 

Package Name

Available as Advanced Property

Text ➖ Write - Designer

Set a custom PackageName for the app. Min 8 chars, max 35 chars, min 3 words, max 5 words, no special chars, only ASCII a-z and dots for separators

Primary Color

Color Default: #3F51B5FF  ➖ Write - Designer

This is the primary color used for Material UI elements, such as the ActionBar.

Primary Color Dark

Color Default: #303F9FFF  ➖ Write - Designer

This is the primary color used for darker elements in Material UI.

RTL Support

Available as Advanced Property

Boolean Default: False ➖ Write - Designer

Property for RTLSupport

Screen Orientation

Text Default: unspecified ➖ Read Write - Designer Blocks

The requested screen orientation, specified as a text value. Commonly used values are landscape, portrait, sensor, user and unspecified. See the Android developer documentation for ActivityInfo.Screen_Orientation for the complete list of possible settings.

Screen.Screen Orientation
setScreen.Screen Orientation to 

Scrollable

Boolean Default: False ➖ Read Write - Designer Blocks

When checked, there will be a vertical scrollbar on the screen, and the height of the application can exceed the physical height of the device. When unchecked, the application height is constrained to the height of the device.

Screen.Scrollable
setScreen.Scrollable to 

Show Lists As Json

Available as Advanced Property

Boolean Default: False ➖ Write - Designer

If false, lists will be converted to strings using Lisp notation, i.e., as symbols separated by spaces, e.g., (a 1 b2 (c d). If true, lists will appear as in Json or Python, e.g. ["a", 1, "b", 2, ["c", "d"]]. This property appears only in Screen 1, and the value for Screen 1 determines the behavior for all screens. The property defaults to "false" meaning that the App Inventor programmer must explicitly set it to "true" if JSON/Python syntax is desired. At some point in the future we will alter the system so that new projects are created with this property set to "true" by default. Existing projects will not be impacted. The App Inventor programmer can also set it back to "false" in newer projects if desired.

Show Navigation Bar

Available as Experimental Property

Boolean Default: True ➖ Read Write - Designer Blocks

Show/Hide Navigation Bar

Screen.Show Navigation Bar
setScreen.Show Navigation Bar to 

Show Options Menu

Boolean Default: True ➖ Write - Designer

Property for ShowOptionsMenu

Show Status Bar

Boolean Default: True ➖ Read Write - Designer Blocks

The status bar is the topmost bar on the screen. This property reports whether the status bar is visible.

Screen.Show Status Bar
setScreen.Show Status Bar to 

Show Title Bar Back Button

Boolean ➖ Read Write - Blocks

If true it will show in the TitleBar a back button only if no side menu was added. If a side menu was added it will remove the ‘hamburger’-menu icon but the side menu can still be opened.

Screen.Show Title Bar Back Button
setScreen.Show Title Bar Back Button to 

Sizing

Text Default: Responsive ➖ Write - Designer

If set to fixed, screen layouts will be created for a single fixed-size screen and autoscaled. If set to responsive, screen layouts will use the actual resolution of the device. See the documentation on responsive design in App Inventor for more information. This property appears on Screen1 only and controls the sizing for all screens in the app.

Splash Image

Available as Advanced Property

Text ➖ Write - Designer

Property for SplashIcon

Splash Screen

Available as Advanced Property

Boolean Default: True ➖ Write - Designer

If set to true the user will see a splash screen while the app is loading the content.

Status Bar Color

Number ➖ Read Write - Blocks

Set status bar color. This will work starting from API Level 21 (Android Lollipop

Screen.Status Bar Color
setScreen.Status Bar Color to 

Status Bar Light Icons

Boolean ➖ Read Write - Blocks

This option tells the system to use dark statusbar icons, useful for lighter colored status bars. Works only for devices with API >= 23.

Screen.Status Bar Light Icons
setScreen.Status Bar Light Icons to 

Theme

Text Default: AppTheme ➖ Write - Designer

Sets the theme used by the application.

Title

Text ➖ Read Write - Designer Blocks

The caption for the form, which apears in the title bar

Screen.Title
setScreen.Title to 

Title Bar Color

Number ➖ Read Write - Blocks

Set title bar color

Screen.Title Bar Color
setScreen.Title Bar Color to 

Title Bar Font Typeface

Number Default: 0 ➖ Write - Designer

Property for TitleBarFontTypeface

Title Bar Subtitle

Text ➖ Read Write - Designer Blocks

Set the TitleBar's subtitle.

Screen.Title Bar Subtitle
setScreen.Title Bar Subtitle to 

Title Bar Text Color

Number ➖ Read Write - Blocks

Set a custom color for the TitleBar text.

Screen.Title Bar Text Color
setScreen.Title Bar Text Color to 

Title Bar Typeface Import

Available as Advanced Property

Text ➖ Write - Designer Blocks

Set a custom font.

setScreen.Title Bar Typeface Import to 

Title Visible

Boolean Default: True ➖ Read Write - Designer Blocks

The title bar is the top gray bar on the screen. This property reports whether the title bar is visible.

Screen.Title Visible
setScreen.Title Visible to 

Tutorial URL

Text ➖ Write - Designer

A URL to use to populate the Tutorial Sidebar while editing a project. Used as a teaching aid.

Version Code

Number Default: 1 ➖ Write - Designer

An integer value which must be incremented each time a new Android Application Package File (APK) is created for the Google Play Store.

Version Name

Text Default: 1.0 ➖ Write - Designer

A string which can be changed to allow Google Play Store users to distinguish between different versions of the App.

Width

Number ➖ Read - Blocks

Screen width (x-size).

Screen.Width