Blurry text on high density screens - android

My application which I built for 1.5, shows text blurry on high density screen of HTC Desire and the like. Here is a close up screen shot from my application (bad.png) and a better example (good.png)
alt text http://taypo.com/bad.png alt text http://taypo.com/good.png
Yes, I am building a soft keyboard. And the text is drawn with canvas.drawText. All the discussions I found online is about image resizing issues.

You should read this guide
Basically, if you want support 1.5 devices you should build your project
against SDK >= 1.6 with the minSdkVersion setted to 3:
<uses-sdk
android:minSdkVersion="3"
android:targetSdkVersion="4"
/>
On this way you will be able to have differents drawable resources for differents
screen size/density without breaking the compability with Android 1.5
which assumes all screens are "mdpi".
obviously you can't use any api released after sdk version 3

Related

Android Different Resolution Support in IBM Worklight

I am searching on different resolution support in IBM Worklight android . From this side i am reading tutorials IBM Worklight Tutorials In tutorial/module 09 they discuss about different resolutions.
In the document there is line which telling:
By default, Android application assumes that the application HTML
file was styled for a screen width of 320 pixels.
When displaying graphical elements on wider screens, Android
automatically scales images and fonts to the appropriate ratio.
For example, on a 480-pixel wide screen, a 100-pixel wide image will
be scaled by 480/320 (= 1.5) to 150 pixels in width
Now i make a Worklight Hybrid project and set a background image in it and two buttons on this image. Its a demo app in which i am testing different resolutions.
Now i deploy this app in android and run it on Tab 7 inch ,nexus 4 and tab 10.1 .Now my image size is 580x320 and bit depth is 24.
When i run this project on nexus 4 it gives the width of image correct but it do not scales the image height vise.
When i run this project on tab 7 2 , it shows the image having some extra white space on the left of image and extra white space on height of image means down the image.
When i run on tab 10.1 it shows the same behavior as the tab 7 2 did.
I am really confuse that which exact general size will be use so that all these scale on all screen sizes and not shows extra white space on width and on height
I would suggest using Worklight Skins in order to support multiple Android devices (with varying screen sizes) in your application.
Idan's answer works for me. I have a android tablet for some reason the app looks very blurry and huge buttons and fonts all the time. I have tried all the different target-densitydpi setting, the button might have change sizes. But everything is still very blurry.
Then I set this in the Android manifest as per Idan.
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="13"/>
Now everything is sharp and crisp on my low resolution tablet. It turns out that Android would automatically do some scaling "screen compatibility mode" even though my device can support better resolution. Android will still treat this as low resolution and scale things automatically. By providing the target, it will stop this behaviour when the device is higher than that Android version. Read more here.
http://developer.android.com/guide/topics/manifest/uses-sdk-element.html

Is it possible to emulate Android phone on Android tablet?

I have a tablet with mdpi screen (xlarge). Is it possible to emulate some other screen configurations on it? I have layouts for middle-size screens and I want to see how they will look like without using emulator (it causes a lot of pain for my PC).
For example, I've seen something like that on iPad (when its running iPhone apps)
can try this link http://developer.android.com/guide/practices/screen-compat-mode.html
add in the manifest file
There are two versions of screen compatibility mode with slightly different behaviors:
Version 1 (Android 1.6 - 3.1)
Version 2 (Android 3.2 and greater)
Disabling Screen Compatibility Mode
If you've developed your application primarily for versions of Android lower than 3.0, but your application does resize properly for larger screens such as tablets, you should disable screen compatibility mode in order to maintain the best user experience. Otherwise, users may enable screen compatibility mode and experience your application in a less-than-ideal format.
By default, screen compatibility mode for devices running Android 3.2 and higher is offered to users as an optional feature when one of the following is true:
Your application has set both android:minSdkVersion and android:targetSdkVersion to "10" or lower and does not explicitly declare support for large screens using the element.
Your application has set either android:minSdkVersion or android:targetSdkVersion to "11" or higher and explicitly declares that it does not support large screens, using the element.
try removing
<uses-sdk android:minSdkVersion="10">
from your AndroidManifest File.
by this, if your project uses like GingerBread then it will show in 480x800

How to build Android apps for tablet sized screens?

I've set up NetBeans to run my app on my Asus Transformet tablet, however, it runs using the size of a phone screen, and then gets stretched over the screen. How do I fix it so it uses the tablets resolution?
You can have custom layouts depending on the size of the screen. For example if you have a xlarge screen you can create the layout folder 'layout-xlarge' and 'layout-xlarge-land'. In these folders you can put the layouts (with the same name and variable names) but change the layout as needed.
I'd suggest reading this as well:
http://developer.android.com/guide/practices/screens_support.html
<uses-sdk android:minSdkVersion="4"
android:targetSdkVersion="11" />
Use targetSDK = 11 to target for the tablets. Your UI will automatically scale to the tablet size. Use minSdKVersion = 4, if your app should run on phones with Android 1.6 or more
For more API levels, you can check this out, http://developer.android.com/guide/appendix/api-levels.html

Android Screen Density Compatibility on 1.5

I'm getting ready to release my first application the marketplace. It's being written for devices running Android 1.5 and above, however there aren't any specific folders for the three different screen densities (I think those came around in 1.6). Should I make these folders myself? Where should I put image resources for the different densities and what should I put in my Manifest??
You will actually want to set your application up to target Android 1.6 in order to get the folders with different drawable levels, but then set the minSdkVersion="3" in the XML and rename the drawable-mdpi folder to just drawable. It will give you a warning about version mismatch but this is how supporting 1.5 but getting the nice features of 1.6 is done in Replica Island for example, which was made by a Google developer advocate. One thing to keep in mind is that by targeting 1.6 instead of 1.5, you can add targetSdkVersion="4", so that it will not force all screens to emulate 320 width, but then you will need to be far more aware of how the app will actually look and test it more thoroughly.
<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="4" />
For more information, read http://developer.android.com/guide/practices/screens_support.html, especially about halfway through where it mentions the XML settings.
There are a number of bugs in the system that need to be worked around as well.
The best strategy I've found to use is:
res
drawable
drawable-hdpi-v4
drawable-ldpi-v4
layout
layout-hdpi-v4
layout-ldpi-v4

Problems wih minSdkVersion 1.5

we have a problem related to the manifest file and the property "android:minSdkVersion".
The issue is: If our platform is 2.0 and we use the property "android:minSdkVersion=3" (3 = sdk 1.5) the graphics get corrupted (In details, the application's resolution get reduced to a 2/3 part of the original size, this is, when the resolution should be 480x720, it becomes in a 320x480). This is happening on the Android emulator, and on the devices Droid/Milestone (Which are platforms 2.0). When we switch the property to "android:minSdkVersion=4" (4 = sdk 1.6) the problem gets solved, but when we want to put that version on platform 1.5, Android doesn't allow us to install it.
It would help us to know any conflict regarding graphics within the 2.0 sdk, or any known problem around the "android:minSdkVersion" in the manifest.
Thanks!
If you specify targetSdkVersion as well as minSdkVersion your application will start to work correctly on all platforms.
So have an entry in your manifest like this:
<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="4"/>
This is covered in the Android API Levels page in the Android Developer documentation.
I assume you're specifying different assets for different screen densities using directories like res/drawable-mdpi, res/drawable-hdpi and so on?
Android 1.6 (API level 4) was the first version of the SDK to support multiple screen densities, so it knows the significance of these directory names and so can successfully select the correct drawable from your res folders for the particular device it's running on.
However, if you run an application developed in this way on an Android 1.5 device (API level 3), then the framework does not know that it should only use the medium DPI resources (as there are no Android 1.5 devices released with anything other than medium DPI screens (AFAIK)). So in this case, the framework can end up choosing seemingly randomly from all the available resource in your APK, whether they're intended for high density screens or medium density screens, or whatever.
However, I haven't seen the reverse happening that you are, i.e. a 2.0 device appears to select drawables for, or assumes, a different screen density.
I would make sure your res directory layout is correct, and that you're using density-independent measurements in each of your layouts as appropriate.
But if you want to support multiple screen resolutions and densities and support Android 1.5 devices in a single APK, then I don't believe it's possible.
Add this tag in your AndroidManifest.xml to support multiple screen densities.
<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="false" />

Categories

Resources