Starting in the most recent public build, all Corona developers can now opt to use two new widget themes in their projects. These new themes are styled after the Android “Holo Light” and “Holo Dark” themes which are commonly found on Android devices running recent versions of the OS.

Both of the new themes contain assets up to the @4x scale profile, which means that your widgets should appear crisp and clean on even the highest resolution Android devices like the Nexus 10.

android-themes

Setting the Themes

The new themes can be set by passing the proper value to the widget.setTheme() API:

-- Use new 'Holo Light' theme
widget.setTheme( "widget_theme_android_holo_light" )
-- Use new 'Holo Dark' theme
widget.setTheme( "widget_theme_android_holo_dark" )

And that’s it — all non-skinned widgets throughout the project will appear in the new chosen theme.

Updated Sample Project

To preview the new themes in action, please load the WidgetDemo sample project included with Corona SDK:

CoronaSDK → SampleCode → Interface → WidgetDemo

Previous Android Theme

Note that using the new Holo themes is entirely optional. The previous Android theme files are still available, so if you wish to continue using that theme, be sure to set the theme as follows:

-- Use older Android 2.x theme
widget.setTheme( "widget_theme_android" )

In Summary

Hopefully you can easily integrate these new themes into your existing projects with a minimal amount of repositioning, although some adjustments will be necessary due to slightly differing sizes of the updated styles.

  1. local function some()
    print('code')
    end

    local function some()
    print(‘lua’)
    end

    local function some()
    print(‘source’)
    end

    local function some()
    print(‘pre’)
    end

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>