[android-developers] Re: Where is the View.setStyle() method?
Ok thanks, I'll use the dimension resource facility, was not aware of it, Thanks On Sep 3, 9:52 pm, Dianne Hackborn wrote: > 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 wrote: > > On Fri, Sep 3, 2010 at 6:01 PM, Mark Wyszomierski > > 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 android-developers@googlegroups.com > > To unsubscribe from this group, send email to > > android-developers+unsubscr...@googlegroups.com > 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 For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Where is the View.setStyle() method?
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 wrote: > On Fri, Sep 3, 2010 at 6:01 PM, Mark Wyszomierski > 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 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 > -- 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
Re: [android-developers] Re: Where is the View.setStyle() method?
On Fri, Sep 3, 2010 at 6:01 PM, Mark Wyszomierski 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 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
[android-developers] Re: Where is the View.setStyle() method?
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" 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. I could grab the device density and scale myself, but are there any other better ways of doing this? Like if I could read the values from my styles in styles.xml and let it rescale for me? I doubt it, but just wondering if there's some way to utilize the dip system, Thanks On Sep 3, 2:51 pm, Mark Murphy wrote: > On Fri, Sep 3, 2010 at 5:42 PM, Mark Wyszomierski wrote: > > Is there a way to set a style for a View at runtime? > > Not that I am aware of, sorry. > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://github.com/commonsguyhttp://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 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