关于在引用资源时使用@还是?的问题,我们在设置style的时候既可以使用@也可以使用?, 例如android:textAppearance="@andorid:style/TextAppearance.Medium",
android:textAppearance="?android:attr/textAppearanceMedium"
使用@表示使用固定的style,而不会跟随Theme改变,这个style可以在style.xml中找到。
而?表示从Theme中查找引用的资源名,例如上面的textAppearanceMedium,查看themes.xml文件,可以看到在不同的theme中,textAppearanceMedium引用的style是不同的。如在Them.Holo中<item name="textAppearanceMedium">@android:style/TextAppearance.Holo.Medium</item>,Theme.Holo.Light中为
<item name="textAppearanceMedium">@android:style/TextAppearance.Holo.Light.Medium</item>