breautek commented on issue #1274:
URL: https://github.com/apache/cordova-docs/issues/1274#issuecomment-1611248228

   > Can someone add an example of that `res/screen/android/splashscreen.xml` 
file?
   > 
   > Because at the moment I have the structure mentioned in the documentation 
but we don't know how to create a good xml.
   
   The cordova hello world app uses 
https://github.com/apache/cordova-android/blob/master/templates/project/res/drawable/ic_cdv_splashscreen.xml
   
   However, it looks like it's not really following the recommended sizing. 
Cordova uses the Icon with background setting, so the [android 
docs](https://developer.android.com/develop/ui/views/launch/splash-screen#dimensions)
 states:
   
   > App icon with an icon background: this must be 240×240 dp and fit within a 
circle 160 dp in diameter.
   
   Looks like our vector is a 512x512dp instead of 240x240. It still does the 
job appearently but I'd probably recommend trying to follow the Android 
suggested sizing here.
   
   To parse out what android expects, it expects 240x240dp canvas with your 
"icon" graphic fitting inside 160dp circle in the center. Everything outside of 
that circle is an unsafe area that might be masked away. It may be clipped when 
drawn, or during any android animations.
   
   Note that android expects an **A**ndroid **V**ector **D**rawable (AVD) which 
is different from an SVG. I believe a SVG may work but android doesn't 
implement a full SVG feature set and using something that android doesn't have 
implement will result in a crash. Android Studio does have a 
[tool](https://developer.android.com/studio/write/vector-asset-studio#about) to 
convert SVGs and and PSD files into AVDs.
   
   `dp` refers to display independent pixel. It's a size relative to Android's 
base density, which is `mdpi`. You can use these values as is if you're 
authoring a vector as vectors can be scaled appropriately on-the-fly. 
Alternatively you can author a PNG, but you'll have to scale them up to the max 
resolution you intend to support. For example, `xxxhdpi` is ~4x the density of 
the base `mdpi`, so you'll need to multiply all `dp` units by 4. Therefore a 
correct PNG canvas is 960x960 px with 640 px diameter circle.
   
   Personally I use rasterized PNGs in my projects with no problems but they 
are less efficient and not recommended by Android.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to