在Android资源xml中引用主题的属性值时使用问号(?)而不是(@)。如下面的ListViewCustomStyle:Android访问属性参考
<ListView
android:id="@+id/MainScreenListView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="?ListViewCustomStyle"/>
如何在代码中使用ListViewCustomStyle的值?如果我试试它的正常方式,即
com.myapp.R.attr.ListViewCustomStyle
然后代码崩溃。有没有特别的方法可以访问它,因为它是对一个项目的引用而不是实际的项目?
Woops ListRowCustomStyle是一个错字;我已经修复 – 2011-01-22 20:09:31