所以问题是,当使用用属性字符串定义的textSize或textAppearance(例如android:textAppearance =“?attr / font_small”)时会抛出资源未找到异常。任何有关这方面的帮助将非常感激:)
更新:
以下是我的样式和属性定义:
样式 -
<resources>
<declare-styleable name="FontStyle">
<attr name="font_small" format="dimension" />
<attr name="font_medium" format="dimension" />
<attr name="font_large" format="dimension" />
<attr name="font_xlarge" format="dimension" />
</declare-styleable>
</resources>
属性def -
position:absolute;
答案 0 :(得分:0)
您必须在styles.xml中创建:
A
并在TextView中使用它:
<style name="TextAppearance.baseText" parent="@android:style/TextAppearance">
<item name="android:textAppearance">?android:textAppearanceSmall</item>
<item name="android:textSize">15sp</item>
</style>
答案 1 :(得分:0)
我不相信?attr / font_small是一个有效的参数,除非你在attr.xml文件中明确声明了它。使用带有textSize的dp值,例如:
android:textSize = "24dp"
或使用以下textExppearance:
android:textAppearance="?android:attr/textAppearanceLarge"
根据您的需要选择大,中,小。