내 사이트의 RSS 리더가 엉망이고 텍스트와 이미지가 모두 포함 된 <description>
태그가 있습니다. 문제없이 사용할 수 있도록 텍스트와 이미지를 두 줄로 나눕니다. 내가 만든 이미지 문자열에 <img src>
태그가 포함되어 있기 때문에 웹보기을 사용하여 이미지를로드하고 있습니다.이미지가있는 WebView가 화면에 맞지 않습니다.
모든 것이 정상적으로 작동하지만 에뮬레이터의 테스트에서 이미지가 최대 720p의 화면에 제대로 나타납니다. 1080p의 Nexus 5 용 에뮬레이터를 사용하면 이미지가 화면에 축척되지 않고 오른쪽에 스크롤 막대가 생깁니다. http://imgur.com/VArmsmb 및 1080p의에서 이미지 :
여기에 문제를 이해하기는 720p의 화면 이미지 http://imgur.com/7zGkX0J
내가이 모든 표시하고있어 조각의 XML :
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="@string/title"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold" />
<ScrollView
android:id="@+id/sv"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@id/title"
android:layout_marginTop="10dp" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<WebView
android:id="@+id/imgWebView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbarStyle="insideOverlay"
android:text="@string/desc" />
<WebView
android:id="@+id/textWebView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/imgWebView"
android:scrollbarStyle="insideOverlay"
android:text="" />
<WebView
android:id="@+id/fullWebView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scrollbarStyle="insideOverlay"
android:text=""
android:visibility="gone" />
<Button
android:id="@+id/readMore"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/textWebView"
android:layout_centerHorizontal="true"
android:text="@string/fullArticle" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>
을
이고이 특정 웹보기의 코드는 다음과 같습니다.
final WebView imgW = (WebView) view.findViewById(R.id.imgWebView);
WebSettings ws = imgW.getSettings();
ws.setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
ws.setLightTouchEnabled(false);
ws.setPluginState(PluginState.ON);
ws.setJavaScriptEnabled(true);
ws.setLoadWithOverviewMode(true);
ws.setUserAgentString("Mozilla/5.0 (Linux; U; Android 2.0; en-us; Droid Build/ESD20) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17");
imgW.loadDataWithBaseURL("http://www.liveplace.gr/", imgCode, "text/html", "UTF-8", null);
왜 이런 일이 일어날 지 모릅니다.
추가로 수정되는 것 같습니다 : '
img 태그 앞에. – duk3r