Xamarin UI Measurement - xamarin

I'm a UI designer working with a junior app developer.
We are working on an app I gave him the assets and there sizes using Zeplin app, he showed me the app and it was different than was design telling me that Xamarin doesn't use pixels or dpi but using a number without any measurement.
Is there any way to help him as a designer or something he can use to make the program use pixels or dpi.

#Muslem Mohammed
I think as you are an UI Designer, you are aware that how to provide assets for native app development if not please check for below process.
You can provide Android Assets in the form of Mdpi drawable, hdpi, xhdpi, xxhdpi.
And for iOS 1x, 2x and 3x same like native app assets.
And the developer place all those images into respective folder with respect to the platform.
Example: For Android you will be providing 5 kinds of images with same name respect to the folder I mentioned above.
sample.png for respective folders with the resolution, developer place those images into Android specific project.
Then developer place all images under resources and keep in respective folders.
For iOS also provide the images with same name and by applying 1x,2x,3x with sample below,
sample.png, sample#2x.png and sample#3x.png.
Then developer go to iOS project and place all ios images into Resources folder.
And finally developer will place the image control like below,
<Image source="sample.png" />
And this will show up the image in iOS and Android as well.

Related

Xamarin Forms Designer in VS2019 other form factor

I develop a Xamarin Forms application for a small android device (480x800 4"). The designer has several "devices", but not such a small one - is there a way to add an own device definition?
The styling for multiple device resolutions could make it adaptive.
First, create new resource files small devices. Then create a method to detect the device size. After that set the resource file based on device size. Add styles to each resource file and spply the styles to your XAML. At last, we have styles that better fit the resolution of the devices we are targeting.
For more steps, you could refer to the link below. https://devblogs.microsoft.com/xamarin/styling-for-multiple-device-resolutions/
You could download the source file from the GitHub for reference. https://github.com/CrossGeeks/MultipleDeviceResolutionSample

Google play tablet 7-inch screenshots

Google play console wants me to add some 7-inch tablet screenshots in order to make the app easily accessible to tablets. But I don't have any tablet. Don't understand what's the problem. I have made screenshots in the final phase of development, testing the game in the Unity editor. I suppose these .png images are as good as if they were made from a phone. I don't even know how to make screenshots from a phone.
Is there a hidden feature to identify a screenshot as being made from the 7-inch tablet? Why don't they simply state the image resolution they want for the tablet "screenshot"??
Actually, it doesn't matter what resolution your image is. Just upload the images to that section, the purpose of that section is only to let your users have a first look of what your app looks like before they install it. If you don't intend to make your app for Tablet, just let that section empty, upload images only to Phone's section.
If you are using an Android phone such as Samsung, I would recommend you have a look at Settings/Advanced Features/ Smart Capture (turn it on). Then you can swipe your screen to take a screenshots (it has a tutorial there)

codenameone downloading files/images visible to other apps

I note that other apps (testing on Android) like WhatsApp, etc have folders that contains images the user has used/downloaded. These folders (like WhatsAppImages) are visible in other apps (Gallery/File Explorers, etc) so you can use those files to share, delete, etc like any other file.
In my codenameone app I download image files but they cannot be seen anywhere on the local device. I understand that for security apps run in a sandbox and this may be why.
But how do these other apps make their downloaded files visible to the general file system and other apps ?
Many Thx
Codename One doesn't support that at this time but you can use native interfaces to add this as explained here for Android: How to save image in android gallery
and here for iOS: How can I save an image to the camera roll?
You can also file an RFE to add this either as a cn1lib or API.

Xamarin.Forms Image Caching Cross-Platform Solution

We have number of images used as app assets, for case of simplicity, let's say 10 images only.
As far as I understand, Xamarin.Forms will not cashe these images, so if I have these 10 images showing in my toolbar (this is just to explain issue, we would not really put 10 images in a tiny toolbar) and I have 5 pages showing same toolbar, that means the 10 images will be loaded each 5 times resulting in total 50 images loaded. I would like to load only 10 images rather than loading 5pages x 10images = 50 images.
In addition, if I have to add these 10 images in our repository, I would have to add at least 3 copies of same image to our repository (1 for Android, 1 for IOS, 1 for UWP). This results in 30 images in repository but in reality I needed only 10.
So, these 2 issues make be believe there should be a better cross-platform solution so I can share same image across all 3 platforms, have only one image used by all 3 platforms (Android, IOS, UWP), and I load an image only once in memory regardless how many times I show in the UI.
You can look into FFImageLoading which supports caching. To have images in your shared code instead of your platform-specific code you could look into embedded images:
Embedded images are also shipped with an application (like local images) but instead of having a copy of the image in each application's file structure the image file is embedded in the assembly as a resource. This method of distributing images is particularly suited to creating components, as the image is bundled with the code.
https://developer.xamarin.com/guides/xamarin-forms/user-interface/images/#Embedded_Images
Keep in mind though that adding images per platform isn't a bad thing. Each platform has its own image versions due to different pixel densities etc. so to make it look good on each platform you might want to consider the platform-specific route.
Another alternative is adding your images as file-linked images in each platform specific file. The image file itself can saved in a single location and file-linked into the correct directories per platform.
There is a library for Xamarin.Forms called Forms9Patch which supports different resolutions and devices just like the specific projects for Android / iOS.
Forms9Patch has a MIT-license, here's the github.
Also this is a video that should give a good general overview.

Multi resolution splash screen, tiles and App icons for Windows Phone 7

I'm developing an application which must work for both WP7 and WP8. And want to create multi resolution splashscreen and Tiles. I know that it can be done easily for WP8 (http://msdn.microsoft.com/en-us/library/windowsphone/develop/ff769511(v=vs.105).aspx)
But how can I do it for WP7 application?
How can I make my application (developed for WP7.5) closer to WP8 but still working on WP7.5-7.8.
I just want my application looks good for both WP7 and WP8 devices.
You can run your app designed for WP7 on WP8 device too, but then you will have problems with screen resolution on some devices. You can develop two versions app WP7 and WP8. Porting is not that difficult, if correctly to this approach. In the articles you can find good advice http://www.developer.nokia.com/Community/Wiki/Maintaining_a_WP7_and_WP8_version_of_a_same_Silverlight_application and http://www.developer.nokia.com/Community/Wiki/Introduction_to_multiple-resolution_support_on_Windows_Phone_8_apps .
Since WP7 devices are all (and always will be) WVGA, there's no point to supporting multiple resolutions. What you can do, though, is support multiple tile sizes on 7.8+, and I'd suggest using Mangopollo for that.
Just reuse your WVGA tile assets from the WP8 version of your app, and make the appropriate changes in your app's WMAppManifest.xml:
<AppExtra xmlns="" AppPlatformVersion="8.0">
<Extra Name="Tiles"/>
</AppExtra>
This should be placed inside the <Deployment> tag before <App>. Then you just need to make sure to change your primary tile's type and assets on first run using Mangopollo, and to use the library when creating or updating any secondary tiles.
That's as close to multi-resolution that WP7 will ever get.

Resources