更改视图的背景图像,NativeScript(Android 个应用程序)
Change Background Image of View, NativeScript (Android application)
我正在尝试更改 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文件夹里。
我认为 background-image 属性 需要稍微调整一下,我将其定义如下并且工作正常:background-image: ~/images/bg_intro_pin.jpg
我正在尝试更改 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文件夹里。
我认为 background-image 属性 需要稍微调整一下,我将其定义如下并且工作正常:background-image: ~/images/bg_intro_pin.jpg