アプリでフォントのスタイルをいくつか作成しました。
これらのスタイルをビューに追加するにはどうすればよいですか?-1)スタイル属性を使用します。2)textAppearanceを使用します。
ビューには他の属性(マージン、パディング、最小幅など-ビューに2つのスタイルを指定できない)がある可能性があるため、スタイルを使用することはできません。したがって、テキスト関連の属性を個別に指定する必要がありますが、android:textColor
ここでは機能しません。
styles.xml:
<style name="TextAppearance.baseText" parent="@android:style/TextAppearance">
<item name="android:textAppearance">?android:textAppearanceSmall</item>
<item name="android:typeface">sans</item>
<item name="android:textColor">@android:color/white</item>
<item name="android:textSize">15sp</item>
</style>
layout.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="65dp"
android:orientation="horizontal" >
<Button
android:id="@+id/backButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/sometext"
android:textAppearance="@style/TextAppearance.baseText"/>
</RelativeLayout>
なぜそれが機能しないのですか?textappearanceでtextcolorを指定するにはどうすればよいですか?