我的应用程序正在使用字体(大小)和其他设备设置,而不是应用程序的字体设置,它改变了应用程序的外观。我希望应用程序将保持其设置或采取应用程序设置,而不是设备的字体大小等设置,有没有办法做到这一点?如何在安卓中的应用程序中设置虚假设置
不同的控件有不同的大小和字体的脸,现在它需要设备不是本地应用程序的字体大小
的字体大小总之如何错误设备设置中的应用?
我的应用程序正在使用字体(大小)和其他设备设置,而不是应用程序的字体设置,它改变了应用程序的外观。我希望应用程序将保持其设置或采取应用程序设置,而不是设备的字体大小等设置,有没有办法做到这一点?如何在安卓中的应用程序中设置虚假设置
不同的控件有不同的大小和字体的脸,现在它需要设备不是本地应用程序的字体大小
的字体大小总之如何错误设备设置中的应用?
在布局中使用dp代替字体大小代替sp。在这种情况下,字体大小不会受到设置的影响。
要设置自定义字体,你需要做这样的事情
TextView tv = (TextView) findViewById(R.id.label_text);
Typeface face = Typeface.createFromAsset(getAssets(),
"fonts/myfont.ttf");
tv.setTypeface(face);
这也将不被系统字体的影响。 此外,您可以使自定义的TextView来解决所有这些问题。
试试这个:
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:textViewStyle">@style/RobotoTextViewStyle</item>
<item name="android:buttonStyle">@style/RobotoButtonStyle</item>
</style>
<style name="RobotoTextViewStyle" parent="android:Widget.TextView">
<item name="android:fontFamily">sans-serif-light</item>
</style>
<style name="RobotoButtonStyle" parent="android:Widget.Holo.Button">
<item name="android:fontFamily">sans-serif-light</item>
</style>
应用样式到你的整个应用程序清单:
<application
android:theme="@style/AppTheme" >
</application>
大功告成:
这不是可能。但是,您可以使用setTypeface()方法设置各个视图的字体。 – tpbapp