我在我的应用程序中使用Roboto light字体.要设置字体,我要添加android:fontFamily="sans-serif-light"到每个视图.有没有办法将Roboto字体声明为整个应用程序的默认字体系列?我尝试过这样但它似乎没有用.
<style name="AppBaseTheme" parent="android:Theme.Light"></style>
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:fontFamily">sans-serif-light</item>
</style>
Run Code Online (Sandbox Code Playgroud) 当EditText处于密码模式时,似乎提示以不同的字体显示(courrier?).我怎么能避免这个?我希望提示以与EditText不在密码模式时相同的字体显示.
我目前的xml:
<EditText
android:hint="@string/edt_password_hint"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:password="true"
android:singleLine="true" />
Run Code Online (Sandbox Code Playgroud) 从API 16开始,Jellybean Roboto作为可用的字体系列推出.在这里看看Android 16中的"新" .
指定android:fontFamily="sans-serif"一个(在的Roboto API 16+)TextView默认fontFamily的TextView?
是
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
Run Code Online (Sandbox Code Playgroud)
相当于
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif" />
Run Code Online (Sandbox Code Playgroud)
?
"Roboto和Noto是Android和Chrome上的标准字体."
来自Wiki,
"Roboto是一款由Google开发的无衬线字体系列,作为其移动操作系统Android的系统字体."
我没有在文档中看到fontFamilyAndroid 的默认设置.见参考文献: