本文介绍了WebView中的自定义字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用Raavi字体创建了一个wordpress网站。我已经使用Wordpress Font Uploader上传了字体。同一个网站我在WebView中运行。当我在模拟器中运行我的android项目时,它会向我显示字体..但是当我运行手机时...我的手机有4.2.2安卓版。它不显示旁遮普字体...只显示英文。但是当我在4.0.2上运行它时。它有效...
请指导我如何让eligile在更高版本上运行...
I have created a wordpress website by using Raavi font. That i have upload the font by using Wordpress Font Uploader. same website I am running in WebView. When I run my android project in emulator it shows me the font.. but when I run my phone.. My phone had 4.2.2 android version. it do not show punjabi font... only english is displaying. but when I run it on 4.0.2. it works...
please guide how can i make eligile to run on higher version...
package com.aarcreationz.bhajanmala;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.ProgressDialog;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Window;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class MainActivity extends Activity
{
WebView mWeb;
ProgressDialog mProgress;
@SuppressLint("SetJavaScriptEnabled")
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
mWeb = new WebView(this);
mWeb.setClickable(true);
mWeb.setFocusableInTouchMode(true);
setContentView(mWeb);
WebSettings settings = mWeb.getSettings();
settings.setJavaScriptEnabled(true);
mWeb.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
mProgress = new ProgressDialog(MainActivity.this);
mProgress.setTitle("Please Wait!");
mProgress.setMessage("Loading...");
mProgress.show();
}
public void onPageFinished(WebView view, String url) {
if(mProgress.isShowing()) {
mProgress.hide();
mProgress.dismiss();
}
}
});
mWeb.loadUrl("http://www.aarcreationz.com/mala");
}
public boolean onKeyDown(int keyCode, KeyEvent event)
{
if ((keyCode == KeyEvent.KEYCODE_BACK) && mWeb.canGoBack())
{
mWeb.goBack();
return true;
}
return super.onKeyDown(keyCode, event);
}
}
推荐答案
这篇关于WebView中的自定义字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!