On Fri, Sep 3, 2010 at 6:01 PM, Mark Wyszomierski <[email protected]> wrote:
> Ah well, is there any better and new way of setting pixel sizes at
> least for a view? For example, my two styles had different image
> widths:
>
>   // style1:
>   layout_width="25dip"
>
>   // style2:
>   layout_width="50dip"

Why not use dimension resources?

> Doing something like this:
>
>   myView.setLayoutParams(new LinearLayout.LayoutParams(50, 50));
>
> would not set the sizes in dip, scaled for the current device display
> specifics.

Why not use dimension resources? getDimension() will apply the scaling for you.

> I could grab the device density and scale myself, but are
> there any other better ways of doing this?

Why not use...

Oh, well, you get the picture.

:-)

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 3.1 Available!

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

Reply via email to