You can just do your own <declare-styleable> of the set of attribute resources you want, and use that like you were doing before.
On Tue, Feb 3, 2009 at 8:15 PM, Kennard Consulting < rich...@kennardconsulting.com> wrote: > > Dear All, > > Given a widget and a int that references a style (defined in my res/ > values/style.xml), what is the 'correct' way to programmatically apply > the style to the widget? > > Up until now I've been hacking this by... > > protected void applyStyle( View view, int style ) { > > TypedArray attributes = getContext().obtainStyledAttributes( style, > android.R.styleable.View ); > > int padding = attributes.getDimensionPixelSize > ( android.R.styleable.View_padding, -1 ); > view.setPadding( padding, padding, padding, padding ); > } > > ...but with the demise of android.R.styleable in 1.0 Release 2, I > guess it's time to implement this properly? > > I note: > > 1. AssetManager.applyStyle is package-protected > 2. Theme.obtainStyleAttributes is hardcoded to use XmlBlock$Parser, > not just an AttributeSet > > So what is the 'official' way? > > Regards, > > Richard. > > > > -- 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. 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 -~----------~----~----~----~------~----~------~--~---