From 11ea33471e1a14a8594f0b2cd012d86340dd3bd8 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Wed, 22 Jul 2009 21:48:55 -0700 Subject: Allow for screen density drawables in compatibility mode. This change allows us to use drawables that match the current screen density even when being loaded in compatibility mode. In this case, the bitmap is loaded in the screen density, and the bitmap and nine-patch drawables take care of accounting for the density difference. This should be safe for existing applications, for the most part, since they shouldn't really be pulling the bitmap out of the drawable. For the small rare chance of them breaking, it worth getting the correct graphics. Also this will only happen when there is actually a resource of the matching density, and no existing apps should have resources for anything besides the default density (though of course all of the framework resources will be available in the native density). As part of this, the bitmap density API has been changed to a single integer provider the DPI unit density. --- core/java/android/widget/ImageView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/java/android/widget/ImageView.java') diff --git a/core/java/android/widget/ImageView.java b/core/java/android/widget/ImageView.java index 27967742a135..6a9bcfbb2fc4 100644 --- a/core/java/android/widget/ImageView.java +++ b/core/java/android/widget/ImageView.java @@ -317,7 +317,7 @@ public class ImageView extends View { public void setImageBitmap(Bitmap bm) { // if this is used frequently, may handle bitmaps explicitly // to reduce the intermediate drawable object - setImageDrawable(new BitmapDrawable(bm)); + setImageDrawable(new BitmapDrawable(mContext.getResources(), bm)); } public void setImageState(int[] state, boolean merge) { -- cgit v1.2.3