Issue
Could somebody please tell me what the difference is between
?android:attr/colorPrimary
and
?attr/colorPrimary
Whichever i use, result is the same. Altough first option causes android.view.InflateException
on some devices.
Solution
Both almost works the same often. when you use ?attr/colorPrimary
, its works totally fine as compiler already knows that 'android' has to be appended.
And regarding you saying that ?android:attr/colorPrimary
gives you exception then in that case, try using the second option only ..
For Example in your styles.xml : The following may/may not work everytime
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:colorPrimary">@color/primary_material_dark</item>
<item name="android:colorPrimaryDark">@color/primary_dark_material_dark</item>
</style>
</resources>
But this majorly works :
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/primary_material_dark</item>
<item name="colorPrimaryDark">@color/primary_dark_material_dark</item>
</style>
Answered By - Jitendra Ahuja
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.