2015-02-11 19 views
2

是什么的Android风格的语法@android VS安卓

<style name="AppTheme" parent="android:Theme.Holo.Light"> 
    <item name="android:actionBarStyle">@style/MyActionBar</item> 
</style> 

而且

<style name="AppTheme" parent="@android:style/Theme.Holo.Light"> 
    <item name="android:actionBarStyle">@style/MyActionBar</item> 
</style> 

注意在使用@android:style/ VS只是用android:的父语法的差异之间的差异。

我已经看到What's the difference between “?android:” and “@android:” in an android layout xml file?但请注意,我的示例不包括问号。

回答

0

他们给出了相同的结果。

[package:]resource语法(糖?)可能是更容易,甚至会在Android Studio中的自动完成。 parent属性用于继承,因此,当属性来自style元素时,该值必须是样式资源。您甚至可以将其与自己的包一起使用,例如com.example.mypsyapp:Oppagangnamstyle

@[package:]type/resource语法对其他非样式资源有效,例如,在布局XML中为@android:drawable/bottom_bar@string/my_string_id。在这些情况下,需要@来确定该值是文字字符串还是对资源的引用。

潜在有用的链接: