Gradient Background

Thread is closed for posting
5 posts, 0 answers
  1. Hugo
    Hugo avatar
    28 posts
    Member since:
    May 2011

    Posted 10 Mar 2015 Link to this post

    I'm not find any solution for gradient or radius background. Is possible in nativeScript?
  2. Alex
    Admin
    Alex avatar
    129 posts

    Posted 13 Mar 2015 Link to this post

    Hi,

    Currently, the styling capabilities of NativeScript cross-platform APIs are limited and there is no way to set gradient background trough the XML declaration of CSS. However, in NativeScript you have access to the the underlining native components for each platform. This means that you can still set gradient background, but you will have to write some platform specific code. 

    Can you please share share more details for you scenario so that we can be of more help? Which platforms are you targeting and what element you want to set the background to?

    Regards,
    Alex
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. Hugo
    Hugo avatar
    28 posts
    Member since:
    May 2011

    Posted 13 Mar 2015 in reply to Alex Link to this post

    Hi Alex,

    I want change properties of native components, for example buttons and labels. Is possible send me one example of  underlining native components for each platform? I work with android and ios

    Thanks
  4. Alex
    Admin
    Alex avatar
    129 posts

    Posted 16 Mar 2015 Link to this post

    Hi,
    The underlying native widgets are accessible trough the ios and android properties of the view. Only one of these properties will have value at runtime, depending on the current platform. You can find more information about the concrete type of the widget backing each View in the ui-widgets article.
    You can do a simple check and set some platform specific properties like this:
     
    if (button.android) {
        // do something to button.android, which is android.widget.Button
    }
    else if (button.ios) {
        // do something to button.ios, which is UIButton
    }

    I have also created a gist that shows how to set page background to a gradient using this approach. You can find it here
    Note, that currently creating a Java native array from NativeScript is quite cumbersome - we are currently working on improving the API.

    I hope that was helpful - we will appreciate any feedback you have.

    Regards,
    Alex
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  5. Hugo
    Hugo avatar
    28 posts
    Member since:
    May 2011

    Posted 17 Mar 2015 in reply to Alex Link to this post

    Thanks Alex

Back to Top