fix image fitting to width in webviews

This commit is contained in:
Andrew Dolgov 2011-12-01 12:05:21 +03:00
parent 08d9b80bb3
commit 417ded36af
2 changed files with 8 additions and 2 deletions

View File

@ -19,6 +19,7 @@ import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.webkit.WebSettings;
import android.webkit.WebView; import android.webkit.WebView;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
@ -103,6 +104,11 @@ public class ArticleFragment extends Fragment implements OnClickListener {
String cssOverride = ""; String cssOverride = "";
web.setBackgroundColor(0x00000000); web.setBackgroundColor(0x00000000);
WebSettings ws = web.getSettings();
ws.setSupportZoom(true);
ws.setBuiltInZoomControls(true);
if (m_prefs.getString("theme", "THEME_DARK").equals("THEME_DARK")) { if (m_prefs.getString("theme", "THEME_DARK").equals("THEME_DARK")) {
cssOverride = "body { background : transparent; color : #e0e0e0}\n"; cssOverride = "body { background : transparent; color : #e0e0e0}\n";
@ -117,7 +123,7 @@ public class ArticleFragment extends Fragment implements OnClickListener {
"<meta name=\"viewport\" content=\"target-densitydpi=device-dpi\" />" + "<meta name=\"viewport\" content=\"target-densitydpi=device-dpi\" />" +
"<style type=\"text/css\">" + "<style type=\"text/css\">" +
cssOverride + cssOverride +
//"img { max-width : 90%; }" + "img { max-width : 98%; height : auto; }" +
"body { text-align : justify; }" + "body { text-align : justify; }" +
"</style>" + "</style>" +
"</head>" + "</head>" +

View File

@ -435,7 +435,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
"<meta name=\"viewport\" content=\"target-densitydpi=device-dpi\" />" + "<meta name=\"viewport\" content=\"target-densitydpi=device-dpi\" />" +
"<style type=\"text/css\">" + "<style type=\"text/css\">" +
cssOverride + cssOverride +
//"img { max-width : 90%; }" + "img { max-width : 98%; height : auto; }" +
"body { text-align : justify; }" + "body { text-align : justify; }" +
"</style>" + "</style>" +
"</head>" + "</head>" +