Android 我应该将文本样式放在我的资源中的什么位置?
因此,我有一个Android 我应该将文本样式放在我的资源中的什么位置?,android,android-xml,android-styles,Android,Android Xml,Android Styles,因此,我有一个styles.xml,包含以下内容: .... <style name="TextAppearance.CustomTheme.Widget.ActionBar.Menu" parent="android:TextAppearance.Holo.Widget.ActionBar.Menu"> <item name="android:textSize">@dimen/text_size</item>
styles.xml
,包含以下内容:
....
<style name="TextAppearance.CustomTheme.Widget.ActionBar.Menu"
parent="android:TextAppearance.Holo.Widget.ActionBar.Menu">
<item name="android:textSize">@dimen/text_size</item>
<item name="android:textStyle">{text_style}</item>
</style>
...
显然这是不可能的。查看引用,它似乎不接受引用,因为与其他属性一样,此属性的文档没有说明以下内容: 这也可能是对资源的引用(在 “@[package:]type:name”)或主题属性(格式为 “?[package:[type:]name”)包含此类型的值
它只说明它接受的常量(以及它们与|的组合)。当我在styles.xml资源文件的android:textStyle属性中编程“bold”时,它起作用了
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="questionStyle" parent="TextAppearance.AppCompat">
<style name="android:textStyle">bold</style>
<style name="android:textSize">18sp</style>
</style>
@颜色/原色
@颜色/原色暗
@颜色/颜色重音
大胆的
18便士
如果这个答案是你的意思。对不起,如果我不明白你的问题
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="questionStyle" parent="TextAppearance.AppCompat">
<style name="android:textStyle">bold</style>
<style name="android:textSize">18sp</style>
</style>