【问题标题】:Nativescript, iOS, setting image as background in CSS not workingNativescript,iOS,在CSS中将图像设置为背景不起作用
【发布时间】:2019-09-03 09:59:35
【问题描述】:

在我的 nativescript 应用程序中,我想将图像设置为背景

background-image: url("res://ic_more")

它适用于 Android,但不适用于 iOS。

此图像存在于 App_Resources/iOS 文件夹中:

我什至可以像这样在Image 中使用它(红色箭头):

<Image src="res://ic_more"></Image>

我相信问题出在 CSS 的某个地方。

已经尝试过: tns platform clean ios

将不胜感激任何帮助

【问题讨论】:

  • 你能分享你应用这个背景图片的布局/视图吗?

标签: css nativescript nativescript-angular


【解决方案1】:

使用此代码在 android 和 iOS 中设置背景图像。

<DockLayout stretchLastChild="false">
   <GridLayout rows="*,*" class="page" backgroundImage="~/app/images/home_bg.jpg" backgroundRepeat="no-repeat" backgroundSize="cover" backgroundPosition="center"> 
   </GridLayout>
</DockLayout>

【讨论】:

  • 谢谢!有用。问题在于背景定位不正确。
猜你喜欢
  • 1970-01-01
  • 2014-01-23
  • 2020-09-12
  • 1970-01-01
  • 2016-09-27
  • 1970-01-01
  • 2012-04-29
  • 1970-01-01
相关资源
最近更新 更多