ImageView, TextView 및 WebView가있는보기가 있습니다. XML보기 :화면에 맞게 웹뷰 이미지를 조정하십시오. android
<?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>
웹보기 내가 블로그에서 얻을 문자열에서 HTML 본문을 가져옵니다. 그것은 텍스트를 잘 보여하지만 이미지가 너무 커서 WebView를 수평으로 스크롤 할 수 있습니다. 내가 사용하려고했습니다
webView.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
을하지만 아무 일도 발생하지 않습니다와 나는 시도했다 :
WebView browser = (WebView) findViewById(R.id.webview);
browser.getSettings().setLoadWithOverviewMode(true);
browser.getSettings().setUseWideViewPort(true);
그것은 크기를 완벽하게 HTML에서 스케일 이미지를 않습니다,하지만 너무 텍스트를 확장하고 텍스트 크기가 매우됩니다 작은. 텍스트 크기는 같지만 크기가 조정 된 이미지는 어떻게해야합니까?
그것은 응용 프로그램에서 보이는 방법은 HTML에서 어떻게 보이는지
http://i.stack.imgur.com/h0yv2.jpg
: 나는 당신이 부분적으로이 문제를 해결하는 데 도움이 될 것입니다
http://i.stack.imgur.com/oFVkE.jpg
HTML에 스타일을 추가해야합니다 (예 :'img {display : inline; 높이 : 자동; max-width : 100 %;}' – orium
나는 너의 예제를 사용하고 최대 너비를 장치 디스플레이 너비로 설정했다. 고맙습니다. – Roo