1

I am using webview to show some html data. i have implemented swipe in this. To use swipes i have used gesturedetector and custom web view by extending webview class. But after all this, fonts are coming too small in tablets. I am using font slider(seekbar) also to change font size. and storing the value of font size in shared prefrence.

LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.font_size, (ViewGroup) findViewById(R.id.flayout));
yourDialogSeekBar = (SeekBar)layout.findViewById(R.id.seekBar1);        
prefs = getSharedPreferences("FontSize", 0);

int size = prefs.getInt("fontSize", 20);
wvBrowser.getSettings().setDefaultFontSize(size);

Before custom webview implementation, it used to show normal font size which was readable.now its not readable.i am using css to set fontsize,font family etc...

  1. Is it because of custom web view?
  2. Is it because of font seekbar?

Please help me to solve the problem.

Anjali
  • 1,623
  • 5
  • 30
  • 50
  • Based on my experience the method which you are using is unreliable. I would recommend set font using css in html. It works well generally 16px to 20px works well. – Akshay Mukadam Mar 03 '15 at 06:37
  • i was doing same before, it was working perfectly. But now i want font slider(seekbar) in the app to increase/decrease the font size. for this i am using shared preference to maintain the font consistency across the app. In oncreate method, retriving the value from sharedprefernce. – Anjali Mar 03 '15 at 06:41
  • possible duplicate of [How to change the FontSize in an Android WebView?](http://stackoverflow.com/questions/3796176/how-to-change-the-fontsize-in-an-android-webview) – Phantômaxx Mar 03 '15 at 08:43
  • not a duplicate. I am already using all those apis...it doesnt work in high resolutions screens – Anjali Mar 03 '15 at 13:47

0 Answers0