久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

我可以更改 Android 自定義鍵盤的輸出字體嗎?

Can I change the output font of an Android custom keyboard?(我可以更改 Android 自定義鍵盤的輸出字體嗎?)
本文介紹了我可以更改 Android 自定義鍵盤的輸出字體嗎?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我開發了一個 android 自定義鍵盤.我需要更改實際使用 unicode 打印的輸出文本的字體樣式.

I have developed an android custom keyboard. I need to change the font style of my output text which are actually printed using the unicodes.

如何在不更改設備默認字體的情況下更改設備中任何位置的鍵盤文本輸出的字體樣式?

How can I change the font style of my keyboard's text output anywhere throughout the device without having to change the device's default font?

字體也不在安卓設備中,所以我們必須從開發鍵盤的同一個應用程序外部提供字體.

The font is also not in android device, so we have to privide the font externally from the same application which is developing the keyboard.

推薦答案

更改應用程序內的字體樣式.

changing the font style inside the application.

創建一個名為

字體覆蓋

import java.lang.reflect.Field;
import android.content.Context;
import android.graphics.Typeface;

public final class FontsOverride {

public static void setDefaultFont(Context context,
        String staticTypefaceFieldName, String fontAssetName) {
    final Typeface regular = Typeface.createFromAsset(context.getAssets(),
            fontAssetName);
    replaceFont(staticTypefaceFieldName, regular);
}

protected static void replaceFont(String staticTypefaceFieldName,
        final Typeface newTypeface) {
    try {
        final Field staticField = Typeface.class
                .getDeclaredField(staticTypefaceFieldName);
        staticField.setAccessible(true);
        staticField.set(null, newTypeface);
    } catch (NoSuchFieldException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }
    }
}

現在創建另一個類來覆蓋名為

now create another class to override the fonts named

應用

public final class Application extends android.app.Application {
    @Override
    public void onCreate() {
        super.onCreate();
        FontsOverride.setDefaultFont(this, "DEFAULT", "fonts/GeezEdit.ttf");
        FontsOverride.setDefaultFont(this, "MONOSPACE", "fonts/GeezEdit.ttf");
        /*FontsOverride.setDefaultFont(this, "MONOSPACE", "MyFontAsset2.ttf");
        FontsOverride.setDefaultFont(this, "SERIF", "MyFontAsset3.ttf");
        FontsOverride.setDefaultFont(this, "SANS_SERIF", "MyFontAsset4.ttf");*/
    }
}

現在將此字體添加到值文件夾中的 android 樣式文件中的樣式

now add this typeface to style in android style file at values folder

<item name="android:typeface">monospace</item>

最后在應用標簽內的android Manifest文件中提到應用名稱

At last mention the Application name at android Manifest file inside application tag

android:name=".Application"

這將有助于將用戶提供的字體更改為 android 項目或應用程序.

This will work to change the user provided font to the android project or application.

這篇關于我可以更改 Android 自定義鍵盤的輸出字體嗎?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

EditText: Disable Paste/Replace menu pop-up on Text Selection Handler click event(EditText:禁用文本選擇處理程序單擊事件上的粘貼/替換菜單彈出)
Multiline EditText with Done SoftInput Action Label on 2.3(2.3 上帶有完成 SoftInput 操作標簽的多行 EditText)
How to detect the swipe left or Right in Android?(如何在 Android 中檢測向左或向右滑動?)
Prevent dialog dismissal on screen rotation in Android(防止在Android中的屏幕旋轉對話框解除)
How do I handle ImeOptions#39; done button click?(如何處理 ImeOptions 的完成按鈕點擊?)
How do you set EditText to only accept numeric values in Android?(您如何將 EditText 設置為僅接受 Android 中的數值?)
主站蜘蛛池模板: 色欧美综合 | 91在线视频免费观看 | 午夜资源 | 国产乱人伦精品一区二区 | 欧美 日韩 国产 成人 在线 91 | 超碰在线免费av | 日日夜夜天天 | 中文无吗 | 国产成人久久久 | 亚洲影音| 日韩av一区二区在线观看 | 北条麻妃一区二区三区在线观看 | 日韩 欧美 综合 | 亚洲精品一区中文字幕乱码 | 污视频免费在线观看 | 国产精品一区二区在线 | 精品久久成人 | 国产精品免费在线 | 美女国产一区 | 天天躁日日躁性色aⅴ电影 免费在线观看成年人视频 国产欧美精品 | 伊人网国产 | 国产农村一级国产农村 | 欧美激情在线精品一区二区三区 | 日韩在线观看 | 国产乱码精品一区二区三区忘忧草 | 亚洲精品电影 | 91在线影院 | 精品亚洲91 | 国产精品伦理一区 | 成人免费视频观看视频 | 九九在线视频 | 91精品久久久久久久久中文字幕 | 情侣黄网站免费看 | 天天干国产 | 国产精品一区三区 | 亚洲一区二区三区在线 | 欧美成年网站 | 亚洲欧美日韩在线一区二区 | 国产成人一区二区三区 | 欧美在线观看一区 | 黄a大片 |