I've run my program on Android 2.3 and Android 4.1 but pictures of my app shown very tiny in android 4.1:
I remove <uses-sdk android:minSdkVersion="5" android:targetSdkVersion="14" />
in manifest.xml
and my app work perfectly on both:
but I dont want to remove <uses-sdk android:minSdkVersion="5" android:targetSdkVersion="14" />
Where is my problem?
abstract of my code is:
public class MapCanvas extends ImageView
{
...
public MapCanvas(Context context)
{
super(context);
}
public MapCanvas(MainActivity context, Bundle state)
{
super(context);
this.context = context;
...
}
...
@Override
protected void onDraw(Canvas canvas)
{
super.onDraw(canvas);
...
//Paint Offset X, Y, Zoom
this.paint.setColor(Color.rgb(51, 51, 51));
this.paint.setFakeBoldText(true);
this.paint.setTextSize(15);
String text = "X:" + OFFSET_X + ", Y:" + OFFSET_Y + ", Zoom:" + MapZoom.Zoom;
canvas.drawText(text, 5, 15, paint);
...
}
...
}
Removing targetSdkVersion
makes it implicitly 1
, enabling all backwards compatibility modes, including UI scaling for apps targeting below API level 4. That explains why removing the uses-sdk
"fixes" the problem.
To fix your code, you will have to scale your pixel sizes and measures with screen density.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With