Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nativescript background-image fullscreen

Tags:

nativescript

I want to create app in Nativescript with fullscreen image on page. I have to use background-image: url('~/images/background.jpg');. But how to make it full screen. Thanks for your help

like image 736
Pamungkas Jayuda Avatar asked Apr 08 '16 13:04

Pamungkas Jayuda


2 Answers

You need to use the NativeScript supported CSS properties to achieve this.

I've used the following CSS on a background-image attached to the <Page> view before and it works fine.

.coverImage {
    background-image: url('~/images/kiss.jpg');
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
}
like image 134
Brad Martin Avatar answered Oct 23 '22 17:10

Brad Martin


This does not work with animated gif. My style:

.page{
    background-image: url("~/assets/images/animated.gif") black;
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
}

The gif is shown, centered and enlarged, so great, but static: the animation does not moves.

like image 26
hgc2002 Avatar answered Oct 23 '22 15:10

hgc2002