среда, 3 сентября 2008 г.

<attr> format types

For some reason, Android's documentation about <attr> values is so poor.
I had to look into aapt.exe to find that you can specify these strings as format attribute value:
  • reference
  • string
  • integer
  • boolean
  • color
  • float
  • dimension
  • fraction
Also, did you know you can specify <enum> inside <attr> to specify set of values?
I will continue investigating this...

UPD: You can specify multiple format values!
Behold: <attr name="test" format="reference|color|fraction"/>

UPD2:You can specify two more attributes: l10n (localization) and type. Their values are ignored though (for now?).

UPD3: You can exclusively specify:
  • min & max attributes
  • enum child tags
  • flags child tags
Although specifying min:max attributes with enum or flag child tags does not result in error, child tags are simply ignored.

UPD4: Min:max values are not checked when specifying attribute value. Also, min can be larger than max. Not implemented, I guess.

Комментариев нет: