zoukankan      html  css  js  c++  java
  • android webview正确显示音标

    package com.example.fonttest;
    
    import android.support.v7.app.ActionBarActivity;
    import android.webkit.WebView;
    import android.os.Bundle;
    
    public class MainActivity extends ActionBarActivity {
    
    	WebView wv;
    	
    	@Override
    	protected void onCreate(Bundle savedInstanceState) {
    		super.onCreate(savedInstanceState);
    		setContentView(R.layout.activity_main);
    		wv = (WebView) findViewById(R.id.wvShow);
    		String pish = "<html><head><style type="text/css">@font-face {font-family: MyFont;src: url("file:///android_asset/font/segoeui.ttf")}body {font-family: MyFont;font-size: medium;text-align: justify;}</style></head><body>";
    		String pas = "</body></html>";
    		String myHtmlString = pish + "/dɒɡ/" + pas;
    		wv.loadDataWithBaseURL(null,myHtmlString, "text/html", "UTF-8", null);
    	}
    
    }
    

    android系统自带的字体都不支持显示音标,只能自己把支持音标显示的字体加入项目中
    在 C:WindowsFontsSegoe UI目录下选择一个常规字体(segoeui.ttf)复制出来放在assets/font/目录下

    Keep it simple!
    作者:N3verL4nd
    知识共享,欢迎转载。
  • 相关阅读:
    ZOJ 3795 Grouping
    ZOJ 3791 An Easy Game
    ZOJ 3790 Consecutive Blocks
    POJ 1451 T9
    POJ 1141 Brackets Sequence
    POJ 2411 Mondriaan's Dream
    POJ 2513 Colored Sticks
    Eclipse 快捷键大全
    C# lock关键字(多线程)
    C# 内部类
  • 原文地址:https://www.cnblogs.com/lgh1992314/p/5834755.html
Copyright © 2011-2022 走看看