Ok, of course I understand this part of the expression...listPreferredItemHeight is the preferred list item height.
But I really don't get these stuff. Anyone can point me to the right direction where I can read about that?
This may also be a reference to a resource (in the form "@[package:]type:name") or theme attribute (in the form "?[package:][type:]name") containing a value of this type.
the example where I find this code is here https://android-developers.googleblog.com/2009/02/android-layout-tricks-1.html
EDIT: in the example at the link the code is android:layout_height="?android:attr/listPreferredItemHeight"
. What exactly does it mean?
The marker "?" means that you are referring to a style attribute. So ?android:attr/listPreferredItemHeight
simply means "use the value defined by the attribute called listPreferredItemHeight in the namespace android."
This attribute and its value are part of the Android framework, hence the "android" namespace.
android:layout_height=
"?android:attr/listPreferredItemHeight"
?[<package_name>:][<resource_type>/]<resource_name>
taken from Referencing Styles.
The ?
is used for referencing style attributes, where as the more familiar looking@
is used for normal resources.
Style attribute resources reference values in the currently applied theme. So values may differ between different themes.
The value of listPrefferedItemHeight
, found in the android package of the currently applied theme is returned to android:layout_height
.
The resource type attr
in the line of code above is optional and can be omitted. Therefore, the following is also correct:
?android:listPreferredItemHeight
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With