What is the difference between
<style name="AppTheme" parent="android:Theme.Holo.Light">
<item name="android:actionBarStyle">@style/MyActionBar</item>
</style>
And
<style name="AppTheme" parent="@android:style/Theme.Holo.Light">
<item name="android:actionBarStyle">@style/MyActionBar</item>
</style>
Notice the difference in the parent syntax of using @android:style/
vs just using android:
.
I have already seen What's the difference between “?android:” and “@android:” in an android layout xml file? but note that my example doesn't include the question mark.
They give the same results.
The [package:]resource
syntax (sugar?) is probably easier and even gets autocomplete on Android Studio. The parent
attribute is used for inheritance, thus the value must be a style resource when the attribute is coming from a style
element. You can even use it with your own package, e.g. com.example.mypsyapp:Oppagangnamstyle
.
The @[package:]type/resource
syntax is valid for other non-style resources, e.g. @android:drawable/bottom_bar
and @string/my_string_id
in layout XML. In these cases, the @
is needed to tell that whether the value is a literal string or a reference to a resource.
Potential useful links:
Android Style Resource
Android Styles and Themes
Android 5.1.0_r5 core source code values
I think that there is no particular difference when called in style.xml. , but :
Make a layout and place a textview there.
Set this code android: textColor = "? Android: textColorSecondary"
inside the textview.
When using @android, you can only colorize the text that you created in src.
But when you use android, you'll see a lot of code opened from the Android framework.
To understand more, please check the attrs.xml file
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