Is it the only way? I think it is too overkill. On Sep 20, 2009, at 12:43 PM, Dianne Hackborn wrote:
> I'm just saying you need to retrieve it from the theme, and the > custom view Api demo is one example I know of doing so. > > On Sat, Sep 19, 2009 at 6:26 PM, <an0...@gmail.com> wrote: > I see, but I am not initializing a custom view. Is there any simple > way to retrieve a predefined attribute value as whatever proper type? > > On Sep 20, 2009, at 1:33 AM, Dianne Hackborn wrote: > >> You are trying to retrieve an attribute identifier as a dimension, >> which is incompatible. If you want to get the value of an >> attribute in the theme, you can use the Theme class (though >> typically you will use <declare-styleable> to define a set of >> attributes you are interested in and retrieve them as a batch; >> there is an example showing this in ApiDemo's custom view). >> >> On Sat, Sep 19, 2009 at 12:28 AM, an0 <an0...@gmail.com> wrote: >> >> Resources.getDimensionPixelSize >> (android.R.attr.listPreferredItemHeight) does not work. >> So how to? >> And any other way to specify resolution independent dimension values >> in Java code? >> >> >> >> >> -- >> 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. >> >> >> >> > > -- > A ghost writing code with soul @ http://wangling.me/. > > > > > > > -- > 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. > > > > -- A ghost writing code with soul @ http://wangling.me/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---