This is a migrated thread and some comments may be shown as answers.

Gradient Background

4 Answers 145 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Hugo
Top achievements
Rank 1
Hugo asked on 10 Mar 2015, 12:16 PM
I'm not find any solution for gradient or radius background. Is possible in nativeScript?

4 Answers, 1 is accepted

Sort by
0
Alex
Telerik team
answered on 13 Mar 2015, 10:39 AM
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.

 
0
Hugo
Top achievements
Rank 1
answered on 13 Mar 2015, 11:25 AM
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
0
Alex
Telerik team
answered on 16 Mar 2015, 01:10 PM
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.

 
0
Hugo
Top achievements
Rank 1
answered on 17 Mar 2015, 03:41 PM
Thanks Alex

Tags
General Discussions
Asked by
Hugo
Top achievements
Rank 1
Answers by
Alex
Telerik team
Hugo
Top achievements
Rank 1
Share this question
or