[mono-android] DrawLine problem with Paint.StrokeWidth = 1
Jonathan Pryor
jpryor at novell.com
Fri Mar 18 11:41:31 EDT 2011
On Mar 18, 2011, at 10:45 AM, Narcís Calvet wrote:
> So this would indicate this is a general Android problem, not a Monodroid
> problem.
Absolutely.
And I'm not sure if it's an Android "problem" or "feature." (It sucks, regardless.)
That aside, the _sole_ reason mandroid.exe generates /manifest/uses-sdk is because...it seemed the right thing to do. :-)
For example, the documentation[0] says that <uses-sdk/> is used to filter which apps are shown in the Android Market, and if <uses-sdk/> isn't present then ~everything assumes that the app will work on apps down to API level 1. Mono for Android apps will not work on API level 3 or lower (Android v1.6 or later is currently required), so not generating <uses-sdk/> seemed like a Bad Thing, and since mandroid.exe knows which API level you're using, generating //uses-sdk/@android:minSdkVersion is trivial and proper.
I had no idea at the time it would cause this level of grief, either. :-/
With that background, I'm torn about whether I <uses-sdk/> should be automatically generated or not. The documentation implies that it should be used, but the results...
Also note that, since <uses-sdk/> IS used by the Android Market, I believe that it would be fairly probable that your "downstream" apps WILL use this element, eventually, so that their apps can't be installed on unsupportable devices. Consequently, you _will_ need to deal with this "problem"...
(My _guess_ as to why this happens is "backward compatibility" -- that Android 1.0 apps assumed a certain screen resolution, and that when screen sizes changed resolutions/got bigger/higher pixel densities/etc. the APIs changed to support it, but to keep existing apps looking "right" they "lied" to the 1.0 apps about the screen size and scaled the output. I have no proof of this, but it makes sense to me, and I'd love some actual information about this...)
> Some screenshots are available at http://bit.ly/hqXjEe. You'll see the
> output is substantially different using the default manifest
> (TestAppDefaultManifest.png) or modifying it (TestAppModifiedManifest.png):
> 1. The second image draws thicker lines.
> 2. The second image draws less lines than the first image and than it
> should. I think the number of lines is correct in the first image.
Which just adds further support for my above conjecture -- no <uses-sdk/> means "Android 1.0" means "scale the output to the screen" means "the image is larger."
Again, from what little I've seen I believe the correct answer to your problem is that this is an Android feature (for better or worse), and thus you'll need to change your code so that things work "right" (however that's defined).
> Having seen that, how do you think we should proceed? If it is the case that
> this is an Android issue perhaps it should be reported directly to Android's
> developers. Do you know which channel should be used for that purpose?
There's lots of people on #android-dev on irc.freenode.net; you could try there, and stackoverflow.com, and the android-developers at googlegroups.com mailing list. This issue isn't specific Mono for Android, and will impact all Android developers...
- Jon
[0] http://developer.android.com/guide/topics/manifest/uses-sdk-element.html
More information about the Monodroid
mailing list