Set default web view font size/family

This commit is contained in:
M66B 2019-03-11 16:28:05 +00:00
parent 1b8c531419
commit 2f6f0d474d
1 changed files with 7 additions and 0 deletions

View File

@ -1445,6 +1445,13 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
settings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
settings.setAllowFileAccess(false);
// Set default font
int px = Math.round(TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_PX, textSize,
context.getResources().getDisplayMetrics()));
settings.setDefaultFontSize(px);
settings.setStandardFontFamily("monospace");
webView.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
onOpenLink(Uri.parse(url));