autolayout - Xamarin forms how to retain spacing and other dimensions for controls, images and Icons across the screen? -


do need have different images different screen sizes ios (4s 5s, , above)? how can set retain dimensions of images/icons , controls across screen sizes , resolutions in ios (using xamarin forms). please refer understand problem autolayout , proportional positioning

but need solution xamarin forms.

i've been using different solutions like:

naming convention

iphone 4 = "image.png" iphone 5,6 (or retina) = "image@2x.png" iphone 6+ = "image@3x.png" 

getting device width , height dependency service:

ios

        public double width         {                         {                 return uiscreen.mainscreen.bounds.width;             }         }          public double height         {                         {                 return uiscreen.mainscreen.bounds.height;             }         } 

android

  public double width     {                 {             var ctx = forms.context;             var metrics = ctx.resources.displaymetrics;             return (convertpixelstodp(metrics.widthpixels));         }     }      public double height     {                 {             var ctx = forms.context;             var metrics = ctx.resources.displaymetrics;              return (convertpixelstodp(metrics.heightpixels));         }     } 

and can resize images depending on screen size, example screenwidth/3.


Comments