Reputation: 575
I want to set the image, which cover full screen width and height. Here I am not able to using 'BackgroundImage' property, because I want to apply 'ScaleTo' property to the images. So need to set the image to images resource. I am using fallowing images sizes for setup the images. 1. 480 * 720 2. 640 * 960 3. 960 * 1440. These are not cover the entire screen in my application, still showing some white space. Pleas suggest what images sizes are suitable for setup images to entire screen.
Upvotes: 0
Views: 210
Reputation: 6953
Try Application.Current.MainPage.Width and Application.Current.MainPage.Height
Or grab it from Android using a dependency service
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Main);
var metrics = Resources.DisplayMetrics;
var widthInDp = ConvertPixelsToDp(metrics.WidthPixels);
var heightInDp = ConvertPixelsToDp(metrics.HeightPixels);
}
Upvotes: 1