How to make font size look the same in webview and textview?

I have a ListView that contains many entries with TextViews and WebViews. And I want them to look the same. But the font size in TextView and WebView is different on some devices (depending on screen size). For TextView, I use sp for WebView, I tried to use setDefaultFontSize and setTextSize.

thank

+3
source share
1 answer

To set a custom font in an Android app

To do this, simply create the assets / folder in the root of the project and place the fonts in your objects (in the form of TrueType or TTF). For example, you can create assets / fonts / and place TTF files there:

 TextView tv=(TextView)findViewById(R.id.custom); 
  Typeface face=Typeface.createFromAsset(getAssets(), "fonts/HandmadeTypewriter.ttf"); 
  tv.setTypeface(face); 

, -.

0

All Articles