相关疑难解决方法(0)

如何为整个Android应用设置默认字体系列

我在我的应用程序中使用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)

android android-fonts

256
推荐指数
9
解决办法
25万
查看次数

Android中的密码提示字体

当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)

passwords fonts android android-edittext

251
推荐指数
6
解决办法
6万
查看次数

Android中的默认字体系列是什么?

从API 16开始,Jellybean Roboto作为可用的字体系列推出.在这里看看Android 16中的"新" .

指定android:fontFamily="sans-serif"一个(在的Roboto API 16+)TextView默认fontFamilyTextView

<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)

来自Material Design排版网站:

"Roboto和Noto是Android和Chrome上的标准字体."

来自Wiki,

"Roboto是一款由Google开发的无衬线字体系列,作为其移动操作系统Android的系统字体."

我没有在文档中看到fontFamilyAndroid 的默认设置.见参考文献:

fonts android font-family roboto

47
推荐指数
1
解决办法
7万
查看次数