You need to use the Theme API to retrieve the values of attributes associated with the theme.
On Sun, Sep 20, 2009 at 1:19 AM, <[email protected]> wrote: > 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, <[email protected]> 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 <[email protected]> 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 >> [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. >> >> >> >> >> >> -- >> A ghost writing code with soul @ http://wangling.me/. >> >> >> >> > > > -- > 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. > > > > > > -- > A ghost writing code with soul @ http://wangling.me/. > > > > > -- 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 -~----------~----~----~----~------~----~------~--~---

