我使用Raavi字体创建了一个wordpress网站。我已经使用Wordpress Font Uploader上传了字体。同一个网站我在WebView中运行。当我在模拟器中运行我的android项目时,它会向我显示字体..但是当我运行手机时...如果不显示字体... 如何在WebView和android项目中添加我的Raavi.ttf字体..这样当我运行应用程序时,WebView使用我的应用程序中的字体而不是来自webserver .... 我的代码在下面给出
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);
}
}