相关疑难解决方法(0)

设置活动中所有textViews的字体?

是否可以为活动中的所有TextView设置字体?我可以使用以下方法设置单个textView的字体:

    TextView tv=(TextView)findViewById(R.id.textView1); 
    Typeface face=Typeface.createFromAsset(getAssets(), "font.ttf"); 
    tv.setTypeface(face);
Run Code Online (Sandbox Code Playgroud)

但我想一次更改所有textViews,而不是为每个textView手动设置,任何信息都将不胜感激!

fonts android textview typeface

51
推荐指数
2
解决办法
4万
查看次数

如何在android中为按钮文本设置特定字体?

我希望我的按钮文本在Copperplate Gothic Light字体中,但我还没有遇到一个简单的干净代码,因为它具有简单的功能.救命!

PS:由于android自带了ariel和其他一些字体,我们需要导入 (因为我刚接触这个字体而缺少更好的单词)我们希望使用的字体.这就是我迄今为止所能收集到的所有内容,这就是我的最终结果.

fonts android text button

37
推荐指数
2
解决办法
5万
查看次数

字体在 Android Studio 预览中更改,但在模拟器/设备中未更改

我正在尝试更改文本视图、复选框、按钮和 android.support.design.widget.TextInputLayout 的默认字体。为了清楚地说明,我设置了“android:fontFamily">cursive<。

它似乎在 Android Studio 预览中正确显示,但不在模拟器中,如下所示。另请注意,该密码(提示)似乎不适用于两者。感谢您的帮助,以强调为什么会发生这种情况。

在此处输入图片说明

样式.xml:

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="android:textColor">#ed328b</item>
    <item name="android:titleTextColor">#ed328b</item>
    <item name="android:textSize">14sp</item>
    <item name="android:fontFamily">cursive</item>
</style>

<style name="TextLabel" parent="Widget.Design.TextInputLayout">
    <!-- Hint color and label color in FALSE state -->
    <item name="android:textColorHint">#ed328b</item>
    <item name="android:textSize">14sp</item>
    <!-- Label color in TRUE state and bar color FALSE and TRUE State -->
    <item name="colorAccent">#ed328b</item>
    <item name="android:textColor">#ed328b</item>
    <item name="colorControlNormal">#ed328b</item>
    <item name="colorControlActivated">#ed328b</item>
    <item name="android:textColorSecondary">#ed328b</item>
    <item name="android:textColorPrimary">#ed328b</item> …
Run Code Online (Sandbox Code Playgroud)

fonts android textview android-studio

8
推荐指数
2
解决办法
7538
查看次数

标签 统计

android ×3

fonts ×3

textview ×2

android-studio ×1

button ×1

text ×1

typeface ×1