Also you can pass a style resource in to the constructor. There is no setStyle() method because you can't change the style after the view is initialized.
On Fri, Sep 3, 2010 at 3:20 PM, Mark Murphy <[email protected]> wrote: > 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]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- Dianne Hackborn Android framework engineer [email protected] 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 [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

