4 Answers, 1 is accepted
0
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
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
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
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:
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
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