Font Embedding :
Typeface myFont = Typeface.createFromAsset(getAssets(), "fonts/arial.ttf");
EditText et=(EditText) findViewById(R.id.edtText);
et.setTypeface(myFont);
Apply Font to all views
// apply the font
Typeface t = Typeface
.createFromAsset(getAssets(), "fonts/myfont.ttf");
ViewGroup vg = (ViewGroup) getWindow().getDecorView();
setFontForAllTextViewsInHierarchy(vg, t);
public static void setFontForAllTextViewsInHierarchy(ViewGroup aViewGroup,
Typeface aFont) {
for (int i = 0; i < aViewGroup.getChildCount(); i++) {
View _v = aViewGroup.getChildAt(i);
if (_v instanceof TextView) {
((TextView) _v).setTypeface(aFont);
} else if (_v instanceof ViewGroup) {
setFontForAllTextViewsInHierarchy((ViewGroup) _v, aFont);
}
}
}
——————————————
//in EditText
public int getCurrentCursorLine(EditText editText)
{
int selectionStart = Selection.getSelectionStart(editText.getText());
Layout layout = editText.getLayout();
if (!(selectionStart == -1)) {
return layout.getLineForOffset(selectionStart);
}
return -1;
}
////////////////////////////////////////
Callin LoadUrl from WebView
1.Webview.loadUrl(String url)
2.The prefix "file:///android_asset/" will cause WebView to load content from the current application's 'assets' folder. For example, a myimage.gif file in the /assets folder can be used in the html image tag as:
<img src="file:///android_asset/myimage.gif">. Same applies to html file.