У меня есть представление с ImageView, TextView и WebView. Просмотр xml:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="@+id/article_details_image_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true" />
<TextView
android:id="@+id/article_details_title_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/article_details_image_view"
android:layout_margin="5dp" />
<TextView
android:id="@+id/article_details_author_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/article_details_title_text_view"
android:layout_margin="5dp" />
<TextView
android:id="@+id/article_details_date_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/article_details_author_text_view"
android:layout_margin="5dp" />
<WebView
android:id="@+id/article_details_body_text_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/article_details_date_text_view"
android:layout_margin="5dp" />
</RelativeLayout>
WebView gets html body from string that I get from blog. It shows text fine but images is too big and I can scroll WebView horizontaly. I've tried to use:
webView.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
Но ничего не происходит, и я пробовал:
WebView browser = (WebView) findViewById(R.id.webview);
browser.getSettings().setLoadWithOverviewMode(true);
browser.getSettings().setUseWideViewPort(true);
Он масштабирует изображения из HTML до идеального размера, но также масштабирует текст, и размер текста становится очень маленьким. Как мне получить тот же размер текста, но масштабированные изображения?
Как это выглядит в приложении:
http://i.stack.imgur.com/h0yv2.jpg
Как это выглядит в HTML:
img{display: inline; height: auto; max-width: 100%;}
- person orium   schedule 08.12.2014