UWP: icon size in app bar/command bar - icons

What icon sizes should I use for the app bar/command bar?
I couldn't find something in Guidelines for tile and icon assets or in UWP App Visual Assets.
Other names: navigation bar (iOS), app bar/action bar (Android), toolbar (Xamarin.Forms)

Image size
The default icon size should be 20 pixels for app bar image at 100% scaling, but you should also provide additional image assets to ensure it looks great on all screens:
appbaricon.scale-100.png - 20 px
appbaricon.scale-125.png - 25 px
appbaricon.scale-150.png - 30 px
appbaricon.scale-200.png - 40 px
appbaricon.scale-400.png - 80 px
Source
I have created a simple XAML page with the CommandBar control and an AppBarButton with a sample image:
<CommandBar>
<AppBarButton>
<AppBarButton.Icon>
<BitmapIcon UriSource="/Assets/Sample.png" />
</AppBarButton.Icon>
</AppBarButton>
</CommandBar>
I have run the app with debugger attached, found the BitmapIcon in the Live Visual Tree in Visual Studio and opened its Live Property Explorer:
As you can see, the height and width of the image is set to 20 device independent pixels. For different display scaling it is the same, but rendered with the appropriate multiple on the screen.
I have also confirmed that this size exactly matches the Segoe UI Symbol font-based icons that are built-in into the AppBarButton control.
I recommend making the icon image without any margin so that its size matches the default image as well as possible

Related

How to set LaunchScreen image width constraint to superview in xamarin iOS project storyboard file?

I am implementing a splash screen for my app. I just came to know about storyboard constraints to support multiple devices. Basically, I feel it very difficult to understand it as a beginner in this, also I see there is no apt documentation in xamarin also. I want to know the steps to set an imageview width to its super view (View controller).
I see what I should do from here, Visual studio Xamarin iOS launchscreen storyboard layout. But, how do I add those constraints, totally no idea..?! Particularly imageview width and height to superview, trailing and leading
Now, I can only know how to set the constraints in designer by dragging, I'v only learnt to center the image to super view in X and Y (Horizontally and vertically). There is no button to add constraints. How to add leading and trailing constraints? I'm using Visual Studio 2017 for Windows
I got it working.
Step 1: Open storyboard file with lowest screen resolution device set (iPhone 4s) and drag & drop an imageview to fill the view controller.
Step 2: Set the uiimageview source from resources/image assets.
Step 3: Click on the image -> Properties Tab -> Layouts section. You will see like this
Step 4 : Properties -> Layout -> Under View group, there is title called Arrange, there is a autosizing box and example box.
Step 5 : You should click all the I-bars and lines in the center to make it red like below to fill the width (you can see that reflecting in the example box as you click)
Now, SAVE and then switch to other devices, you should have that UIImageview filling the device's height and width.
This will be very useful for important UI auto designs like splash screen.

Add iPhone XR support to existing iOS app in Xcode 10

I have an iOS application that is working fine in an iPhone X or XR the only problem is that i see the black areas on top and bottom so the app is not taking the hole of the screen.
Im using Auto Layout option in the Storyboard.
I also was reading that you can fix this by adding a Launch Image specific size to the assets but I just opened my assets and I don't see a new space for iPhone X or XR images.
Im I doing something wrong?
If you are using a LaunchScreen.storyboard with a ImageView you need to uncheck "Use Safe Area Layout Guides" or set Up and Bottom constraints to superview instead of Safe Area.

Meteor mobile-config.js launchScreens

I'm creating the splash images for my app but I've got some questions:
Can I create of all them at once? I've seen some repos for this but
there are not updated with new sizes (e.g 2048x1536)
Would be possible to use the same image for different sizes?
My phone is 1920x1080 but there is no splash screen size for that so it takes one and applies a disproportionate image. If I've got
text on it it looks really badly.
What happens with the rest of images when I build? Meteor removes the rest? Are located in resources/splash.
Could be possible to use a html with css page?
Thanks in advance!
Next time you should consider splitting your questions into independent posts.
Creating splash images: if your image is simple enough, indeed you have many scripts that can generate the different sizes automatically. I am sure you can customize them to fit your sizes.
Use the same image for different sizes: in general, that would mean your image will be stretched by the device to fill the screen. On Android, you can define a 9-patch PNG that will tell the device which pixels can be stretched, so that some part(s) of your image is not deformed.
Deformed image for 1920x1080 screen: depending on the pixel density, there should very probably be a placeholder for that.
Storage of image versions: by default, all versions (i.e. sizes) are packaged within your APK / APP, so that whatever the device needs will be available once user has downloaded the app.
Using an HTML+CSS page for splash screen: in general, no, but it depends on what you want to do with your splash screen. Meteor calls it "launch screen", because it is the first thing it displays while the app is loading / "launching". In particular, the WebView and local server may not be ready yet, and cannot serve any HTML/CSS. That is why you have to use a plain image, which is passed to a very simple activity while the app is loading. But some people also use a "waiting screen" between some parts of their app. In that case, your WebView and local server are already loaded, and you can simply use whatever you want.
Update:
For Android, if 9-patch PNG does not fit your need, you can also try to request Cordova's splashscreen plugin to maintain the aspect ratio of your image:
https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-splashscreen/#preferences
<preference name="SplashMaintainAspectRatio" value="true" />
"SplashMaintainAspectRatio" preference is optional. If set to true, splash screen drawable is not stretched to fit screen, but instead simply "covers" the screen, like CSS "background-size:cover". This is very useful when splash screen images cannot be distorted in any way, for example when they contain scenery or text. This setting works best with images that have large margins (safe areas) that can be safely cropped on screens with different aspect ratios.
In Meteor, you would use App.setPreference in mobile-config.js:
App.setPreference("SplashMaintainAspectRatio", true, "android");

What are the correct AppBarButton icon sizes to include with UWP apps?

Note: This question is only about AppBarButton icons.
In writing a UWP app that runs on all form factors, I'd like to include all necessary variations of AppBarButton icons.
From what I've read so far, it seems that I need 24x24 icons in each of the five scale factors, 100%, 125%, 150%, 200%, and 400%. In other words, 24x24, 30x30, 36x36, 48x48, 96x96.
Is this correct?
Also, how should these be named so that the system correctly picks the right variant given the base name?
Edit: I've read elsewhere that only one size is needed, and that Windows UWP renders the icon in device-independent units (i.e. scales it appropriately.)
By comparison, iOS allows multiple images to be included with the #2x and #3x suffixes, and Android allows images to be placed in special subdirectories, e.g dir-hdpi, dir-mdpi, where dir is the base directory name. So it seems that UWP does not have such a system, and only a single icon is necessary. Is this revised understanding correct?
You are right: UWP apps render the size of the icon depending on the device. But you can use the icons using Segoe MDL2 in your appbar buttons. There are many icons prepared to be scaled automatically. I use this technique in all my UWP apps without problems.
https://msdn.microsoft.com/en-us/library/windows/apps/jj841126.aspx
If you are using a png image for your icon, I recommend you to set the size of this image to 48x48 pixels, which is the default size for appbar image icons. The UWP system will then automatically scale your icons without rendering problems.

AppBar button icon not fitting inside elipse

Hey I am creating bottom app bar and adding 3, app bar button to it like shown below. One use inbuilt icon and the other two uses Bitmap icons
<AppBarButton>
<AppBarButton.Icon>
<BitmapIcon UriSource="ms-appx:///Assets/Like.png" Height="20" Width="20"/>
</AppBarButton.Icon>
AppBarButton with bitmap icons display correctly in the design view, that is enclosed within the eclipse of appbar button. But when I deploy it on my phone the app bar button looks like below (two on the right)
https://s24.postimg.org/q3yg74gx1/wp_ss_20150309_0002.jpg
What is wron with it
I think you may have forgotten about appropriate padding - more information at MSDN:
I recommend you to find default Windows Phone icons in Microsoft SDKs folder on your PC. In my case it's C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.1\Icons\Light. There you can check how to correctly prepare icons for your application bar.
They must be 76 x 76 PNG images (including padding) with alpha channel.

Resources