cpr*_*ack 5 android android-layout android-styles
我在styles.xml 中定义了以下样式:
<style name="NotificationTitle"
parent="android:TextAppearance.Material.Notification.Title" />
Run Code Online (Sandbox Code Playgroud)
如您所见,它扩展了 Android 中定义的以下默认样式:
<style name="TextAppearance.Material.Notification.Title">
<item name="textColor">@color/notification_primary_text_color_light</item>
<item name="textSize">@dimen/notification_title_text_size</item>
</style>
Run Code Online (Sandbox Code Playgroud)
现在,回到我的styles.xml 文件,我想创建以下自定义样式,其“android:tint”属性设置为与父样式中定义的“textColor”相同的值。我试过这样的事情:
<style name="NotificationIcon" >
<item name="android:tint">@style/NotificationTitle.textColor</item>
</style>
Run Code Online (Sandbox Code Playgroud)
但是我不能像那样引用“textColor”,它无法解析符号。那么如何从我的自定义样式中引用另一种样式中定义的另一个属性呢?如果不可能,最好的选择是什么?