Designer 10.5 | webMethods Mobile Development | Building the User Interface for a Mobile Application | Using Colors, Sizes, Styles and Themes | Using ApplicationStyle to Define Android Styles and Themes
 
Using ApplicationStyle to Define Android Styles and Themes
This section describes how to customize the look and feel of your Android application.
The ApplicationStyle allows you to define styles and themes for your Android project. In Android, a style is a collection of properties that specify the look and format for a view. For more information about Android styles and themes, see https://developer.android.com/guide/topics/ui/themes.html.
Note:
Ensure your application model contains an ApplicationStyle.
*To define an ApplicationStyle for a mobile application
1. Ensure the mobile project is open in the Outline Editor. For instructions, see Displaying a Mobile Project in the Outline Editor.
2. In the Model section of the Outline Editor, expand the outline so that you view the Styles node.
3. Right-click the Styles node and select New Child > ApplicationStyle.
The ApplicationStyle node provides a child called Android Theme. You can add an Android Theme by right-clicking the ApplicationStyle node and selecting New Child -> Android Theme. After adding an Android Theme to the Application Style, a new editor opens showing all the defined styles and themes. You will find the corresponding themes.asl file in your your_project/model/resources/ directory.
Note:
A mobile project can only contain one Android Theme file.
A project created with Mobile Suite 9.12 already contains an Android Theme with default values set. Projects created with versions of Mobile Suite before 9.12 take these values as defaults as well:
values {
<style name="ToolbarTheme" parent="ThemeOverlay.AppCompat.Dark">
</style>
<style name="ToolbarPopupTheme" parent="ThemeOverlay.AppCompat.Light">
</style>
}

values-v14 {
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
</style>
}
The editor allows editing of styles and themes in a XML-based language that is familiar to Android developers. You can group a collection of styles within a values category. The values category can contain an optional resource qualifier, stated by the suffix -qualifier, e.g. values-v14. For more information about Android resource qualifiers, see https://developer.android.com/guide/topics/resources/providing-resources.html. In Android, each style can contain a set of items, see ( https://developer.android.com/guide/topics/resources/style-resource.html).
You can customize the theme of an Android project by adding the style named AppBaseTheme to your values category.
Note:
Note that themes are limited to AppCompat, e.g. Theme.AppCompat.Light, Theme.AppCompat and Theme.AppCompat.DayNight.
After code generation, an XML file is created for each of your values categories. Generated files are placed in the your_project/gen/.assets/android/res directory. Each of the values categories is stored in a directory named after the category itself, e.g. /values-v14. This directory contains a single styles.xml file containing your declared styles and themes. During the multi-build, the entire content of the your_project/gen/.assets/android/res directory will be copied to the cross compiled Android project.
Related Topics