I am developing windows 8 metro app using XAML/C# .
I have added scaled versions of every images in the solution to support different screen resolutions .
Each image will have 2 additional copies in different sizes (100,140,180 %).
eg: sample_100.png,sample_140.png,sample_180.png
Now i want to know how can i choose the correct image based on screen resolution?
Us using a converter a good practice?
You don't need to do anything if you name them correctly. If you use names like
sample.scale-100.png
sample.scale-140.png
sample.scale-180.png
then you can use them in XAML by just typing sample.png. It automatically picks up the one with the correct resource qualifier.
Check this msdn article:
http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh965324.aspx
Related
I used to develop for Android and iOS, and for multiple screen support we use to use mdpi, hdpi, xhdpi.
Now I want to develop for Windows Phone, I want to set a background to a button and I don't know how to define image size to support all screen sizes.
You dont need to provide different assets. See info from MSDN below.
There is a way to support different assets/resources. But we have never done this bevore in our apps.
From MSDN:
Assets such as graphics, video, audio, and icons make up a large
percentage of an app’s size. Including assets for all resolutions in
your app uses a lot of space in your app. For most apps, we recommend
that you include only WXGA assets. WXGA assets have the highest
quality, and they automatically scale to work well for other
resolutions.
More info: Multi-resolution apps for Windows Phone 8
Multiple resolution handling is built-in with WP8.1. You simply need to name your images with the proper qualifier to ensure it is loaded properly by the device.
You can refer to the tutorial here for more info on how to properly name your image resources:
Quickstart: Using file or image resources
It's my first time trying to publish my app on Google Play. I am using Xamarin 4.2 and C#.
My questions:
Can I use Microsoft Paint to create launcher icons?
My plan is to create 36x36px (ldpi), 48x48 (mdpi), 72x72 (hdpi) and 96x96 (xhdpi) launcher icons: Is this Ok so far?
The documentation says .PNG; I guess ldpi and mdpi are just naming conventions?
However my search found different numbers of icons and different sizes.
My plan is to place each of these icons under a separate folder as follows:
Resources\drawable\drawable_ldpi\ic_launcher
Resources\drawable\drawable_mdpi\ic_launcher
etc. Is this arrangement correct?
What about the high resolution application icon: Is it placed in the resources folder? or uploaded separately into Google play console?
First take a look at googles iconography guide: http://developer.android.com/design/style/iconography.html
As you can see each density has a name, you should create a drawable_(density) folder inside the resources directory for each one you plan to support and use the correct icon size.
As an example you should have Resources/drawable_mdpi (density ñame is always in lower case)
And for the hi res icon i supose you refer to the image for google play, it is uploaded when you fill your apps description.
About using Paint to create those icons, well, using paint for anything more complex than drawing a line is a bad idea...
If you don't have any program like Photoshop you always can use Gimp, its free and very powerful:http://www.gimp.org
I am new to windows phone development. I have an issue regarding screen size variation and I successfully handle the UI according to resolution but problem is that I don't have any idea how to change the size of text for different resolutions, use different images for different resolution etc.
As in Android we have different asset folders. We just put our data in folders and it will use best option automatically according to the screen size . I did a lot of Googling but did not find a suitable solution for it. Any idea how I can achieve this?
You shouldn't pay attention to screen sizes at all, everything is scaled up automatically and applications look good on smaller and larger screens.
If you want to customize the design for your screen depending on the screen size, DPI or something else, take a look at the proposed solution here: http://developer.nokia.com/community/wiki/Advanced_Techniques_for_Big_UI.
Is there any way or general size template created for windows 8 app using xaml so that we can create application of different screen size and DPI. As we are having in Android we put images and screen UI in different folders and application picks it up depending on different screen size and DPI? I am trying to design a general template for this but just asking if MS has already created something like this?
Besides the default templates that come with VS2012 I am not aware of any other templates. Working with the diff. requirements aren't that much of a hassle if you know how to get started. Here is some information that you might have already seen, but I'll add it here for those reading you questions looking for some information :)
There are different recommendations for scaling to screen size and resolution.
In regards to pixel density and images :
Guidelines for scaling to pixel density (Windows Store apps)
Basically you create folders like so:
Option #1 - File naming convention:
...\test.scale-100.jpg
\test.scale-140.jpg
\test.scale-180.jpg
Option #2 - Folder naming convention:
...\scale-100\test.jpg
\scale-140\test.jpg
\scale-180\test.jpg
in XAML
<Image Grid.Row="0" Grid.Column="1" x:Name="testImage" Source="test.jpg" Margin="2,2,2,2"/>
The resource loading is smart and will fetch the right image from the right folder
As for scaling to screens
Guidelines for scaling to screens (Windows Store apps)
You could:
a) Have a fixed layout that scales to fit the screen
Create a Viewbox control and add your controls to it, set the size to the minimum size you want to support.
Don't add appbars or other stuff that is by default adaptive!
Define letterboxing style and color, and don't forget to add different res. images as I showed above.OR use vector graphics or XAML.
b) Adaptive layout ,- check out the default templates that come with VS2012, they use adaptive layout.
c) I'm sure there are other options/variations
i'm developping an application in CF 3.5 for windows Mobile 6 Pro using C# and i have a little issue requiring the advice of someone that knows better.
Basically, i want my application to run and scale on multiple device sizes and resolutions. Eveything scales properly but the images.
Some images that are for example 16X16 will look very small on a high resolution screen, so I want to display a 32X32 image, but I don't know what's the best way to decide which image size to display.
I have the option to check the dpi and then manually choose which image to display, but it seems like dirty work.
Isn't there any way to do it otherwise or what's the best way to do it?
I recommend that you create a layer between your forms and the images. Create a new class that would be responsible for returning the correct sized image. The code in your forms will rely on that to get the image and would have to know nothing about the sizes. For example:
mypicturebox.Image = ImageFactory.Image01;
The good thing is that you can use any technique you want inside the ImageFactory without affecting the rest of the code. The easiest thing to do is to check the size of the screen (using Screen.PrimaryScreen.WorkingArea) and do a manual decision.