I am trying to change the background Image of a view of my android mobile application. I am using NativeScript to create a hybrid application but it is not working.
XML of the view
<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 of the view:
Page{
background-image: url('~/images/back.jpg');
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center;
background-size: cover;
}
Note: the image that i want to put for the background is back.jpg and it is in the images folder under the app folder.
我认为background-image属性需要一些调整,我对其定义如下,并且可以正常工作: background-image: ~/images/bg_intro_pin.jpg
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.