Answer the question
In order to leave comments, you need to log in
How to change text size in WebView?
@RequiresApi(api = Build.VERSION_CODES.ICE_CREAM_SANDWICH)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail);
WebView webView = (WebView) findViewById(R.id.webView);
webView.getSettings().setTextZoom(100);
webView.setBackgroundColor(0x00000000);
Intent intent = getIntent();
//получаем строку и формируем имя ресурса
String resName = "n" + intent.getIntExtra("head", 0);
Log.i("name", resName);
Context context = getBaseContext(); //получаем контекст
//читаем текстовый файл из ресурсов по имени
String text = readRawTextFile(context, getResources().getIdentifier(resName, "raw", "com.veresnikov.linuxcommands"));
webView.loadDataWithBaseURL(null, text, "text/html", "en_US", "utf-8" );
}
<integer name="text_stok">100</integer>
Answer the question
In order to leave comments, you need to log in
how do you refer? In general, you can not work with zoom:
webview.getSettings().setDefaultFontSize(newFontSize);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question