[英]How to use system custom fonts in Android Studio
In some devices, there is a option to customize the font in the device settings.在某些设备中,可以在设备设置中自定义字体。 Also, some devices may not use the Roboto
font.此外,某些设备可能不使用Roboto
字体。 How can I ensure that my app can use the system font, instead of a fixed font in my app?如何确保我的应用程序可以使用系统字体,而不是我的应用程序中的固定字体? I am using Kotlin 1.3 on Android Studio 3.5.我在 Android Studio 3.5 上使用 Kotlin 1.3。
Don't use custom fonts in your views like -不要在您的视图中使用自定义 fonts,例如 -
<TextView
....
android:fontFamily="@fonts/Arial"
....
/>
or by TypeFace
or by style like -或按TypeFace
或按样式,例如-
<style name="Regular">
<item name="android:fontFamily">@font/dancing_script</item>
</style>
If you set a custom font manually than your app will use that custom font in every device.如果您手动设置自定义字体,那么您的应用将在每个设备中使用该自定义字体。 But if you don't use a custom font than device's font is applied on your views.但是,如果您不使用自定义字体,则设备的字体将应用于您的视图。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.