Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在某些设备中,可以在设备设置中自定义字体。此外,某些设备可能不使用该Roboto字体。如何确保我的应用程序可以使用系统字体,而不是我的应用程序中的固定字体?我在 Android Studio 3.5 上使用 Kotlin 1.3。
Roboto
不要在您的视图中使用自定义字体,例如 -
<TextView .... android:fontFamily="@fonts/Arial" .... />
或按TypeFace或按样式,例如-
TypeFace
<style name="Regular"> <item name="android:fontFamily">@font/dancing_script</item> </style>
如果您手动设置自定义字体,那么您的应用将在每个设备中使用该自定义字体。但是,如果您不使用自定义字体,则设备的字体将应用于您的视图。