我正在尝试更改我的Android移动应用程序视图的背景图像 . 我使用NativeScript创建混合应用程序,但它无法正常工作 .
视图的XML
<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="onNavigatingTo" actionBarHidden="true" >
<StackLayout orientation="vertical">
<Image src="rec://logo" stretch="none" horizontalAlignment="center"/>
<Button text="Click" />
<Button text="Click"/>
</StackLayout>
视图的CSS:
Page{
background-image: url('~/images/back.jpg');
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center;
background-size: cover;
}
注意:我想要为背景添加的图像是back.jpg,它位于app文件夹下的images文件夹中 .
1 回答
我认为background-image属性需要一些调整,我将它定义如下,它工作正常:
background-image: ~/images/bg_intro_pin.jpg