我有这种android风格:
<resources> <style name="TextAppearance.A.B.Base" parent="TextAppearance.AppCompat">
<item name="android:ellipsize">end</item>
<item name="android:gravity">start</item>
<item name="android:maxLines">1</item> </style>
<style name="TextAppearance.A.B" parent="TextAppearance.A.B.Base"/>
<style name="TextAppearance.A.B.C" parent="TextAppearance.A.B">
<item name="fontFamily">@font/google_sans_medium</item>
<item name="android:textSize">14sp</item>
为什么需要中间人?
<style name="TextAppearance.A.B" parent="TextAppearance.A.B.Base"/>
不是吗?
<resources> <style name="TextAppearance.A.B.Base" parent="TextAppearance.AppCompat">
<item name="android:ellipsize">end</item>
<item name="android:gravity">start</item>
<item name="android:maxLines">1</item> </style>
<style name="TextAppearance.A.B.C" parent="TextAppearance.A.B.Base">
<item name="fontFamily">@font/google_sans_medium</item>
<item name="android:textSize">14sp</item>
</style>
我在现有代码中看到了它,并且不确定为什么需要此项。
还有namespace inheritance
对explicit inheritance
吗?
所以这也行吗?
<resources> <style name="TextAppearance.AppCompat.A.B.Base">
<item name="android:ellipsize">end</item>
<item name="android:gravity">start</item>
<item name="android:maxLines">1</item> </style>
<style name="TextAppearance.AppCompat.A.B.Base">
<item name="fontFamily">@font/google_sans_medium</item>
<item name="android:textSize">14sp</item>
</style>
parent
属性仅用于使名称空间不太长?