Not that I can think of off-hand, barring manually loading the bitmaps
yourself through the lower-level APIs.

On Mon, Jul 12, 2010 at 9:40 AM, Al Sutton <a...@funkyandroid.com> wrote:

> Thanks for the pointer.
>
> The problem then becomes one of duplication. I have to support Android
> 1.5 as well as 1.6+, so is there a way of avoiding having copies in
> drawables and drawables-nodpi?
>
> Al.
>
> On Jul 12, 5:29 pm, Dianne Hackborn <hack...@android.com> wrote:
> > For compatibility reasons, bitmaps in the folder that doesn't specify a
> dpi
> > ("drawable") are assumed to be mdpi, and will thus be scaled if used in a
> > different density screen.  If you want a bitmap but that does not scale
> > based on density, use "drawable-nodpi".
> >
> >
> >
> >
> >
> > On Mon, Jul 12, 2010 at 9:26 AM, Al Sutton <a...@funkyandroid.com>
> wrote:
> > > I'd like to know if someone can tell me if this is intended behaviour
> for a
> > > reason, or just a long standing bug thats in 1.6 and above;
> >
> > > In a nutshell; I have a layout which has four ImageButtons and three
> sets
> > > of four icons located in the drawables folder (1 icon per button per
> screen
> > > size out of QVGA, HVGA, WVGA).  If I programatically try to set the
> button
> > > to set the ImageButtons image Android will ignore any maximum size I
> > > programatically specify and scale the ImageButton up beyond the size of
> the
> > > icons & the specified maximum size.
> >
> > > For those who are more comfortable in code; my manifest contains;
> >
> > >        <uses-sdk                       android:minSdkVersion="3"
> > >
>  android:targetSdkVersion="4"
> > > />
> > >        <supports-screens       android:largeScreens="true"
> > >
>  android:normalScreens="true"
> > >
>  android:smallScreens="true"
> > >
>  android:anyDensity="true"/>
> >
> > > and I have;
> >
> > >        layout/buttonbar.xml
> >
> > > which contains serval instances of;
> >
> > >    <ImageButton        android:id="@+id/button"
> > >                        android:layout_width="wrap_content"
> > >                        android:layout_height="wrap_content"
> > >                        android:background="@android:color/transparent"
> > >                        android:scaleType="center"
> > >                        android:layout_weight="0"/>
> >
> > > I also have;
> >
> > >        drawable/ic_button_small.png                    (a 32x32 icon)
> > >        drawable/ic_button_medium.png           (a 48x48 icon)
> > >        drawable/ic_button_large.png                    (a 64x64 icon)
> >
> > > The problem is, if I, in onCreate for an activity, on a hdpi WVGA
> device
> > > (e.g. the Nexus One), do;
> >
> > >        final ImageButton button = (ImageButton)
> > > activity.findViewById(R.id.button);
> > >        button.setMaxHeight(64);
> > >        button.setMaxWidth(64);
> > >        button.setImageResource(R.drawable.ic_button_large);
> >
> > > the each button gets scaled up to be 96x96 (and looks very ugly).
> >
> > > If, however, I copy all of the icons into drawable-hdpi, all of the
> buttons
> > > are correctly sized at 64x64.
> >
> > > To me the icons should not be scaled up for three reasons;
> >
> > > 1) The maximum size of the button was specified as 64x64, and so
> shouldn't
> > > be scaled up to 96x96.
> > > 2) The manifest declares anydenisty, and so UI elements shouldn't be
> scaled
> > > by the OS.
> > > 3) The drawable directory does not specify which densities the icons
> are
> > > for, therefore the OS shouldn't assume they're mdpi icons which need
> scaling
> > > on a hdpi device.
> >
> > > What do other people think?
> >
> > > Al.
> >
> > > --
> >
> > > * Looking for Android Apps? - Tryhttp://andappstore.com/*
> >
> > > ======
> > > Funky Android Limited is registered in England & Wales with the company
> > > number  6741909.
> >
> > > The views expressed in this email are those of the author and not
> > > necessarily those of Funky Android Limited, it's associates, or it's
> > > subsidiaries.
> >
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > > To post to this group, send email to
> android-developers@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com><android-developers%2Bunsubs
> cr...@googlegroups.com>
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
> >
> > --
> > Dianne Hackborn
> > Android framework engineer
> > hack...@android.com
> >
> > Note: please don't send private questions to me, as I don't have time to
> > provide private support, and so won't reply to such e-mails.  All such
> > questions should be posted on public forums, where I and others can see
> and
> > answer them.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to