如何更改SwitchPreference的字体属性?
我已经尝试使用以下布局的app:layout
属性:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@android:id/title"
style="@android:style/TextAppearance.Widget.TextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="MY-FONT"
android:text="Title" />
<TextView
android:id="@android:id/summary"
style="@android:style/TextAppearance.Widget.TextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="MY-FONT"
android:text="Summary" />
</LinearLayout>
这不好用,因为开关丢失了,一切看起来都有些乱。
什么是自定义fontfamily和textSize的简单(和工作)方式?
要首先在android中更改字体系列,您需要在您的应用程序中使用类似于Your font goes in the font directory under res的字体
现在使用它,你的方式正确
<Button
...
android:fontFamily="@font/nameOfFont"
... />
请让我知道这对你有没有用