Reputation: 12027
Hai Freinds, I had parsed the image from the url, and displayed in the webview, when i am displayed it in webview, a few images were streched, so i displayed the image with the help of Imageview, but the problem is the Images are not displayed in Imageview when they Color format is CMYK format, so pls tell me how to display the image in a webview without strecth of the image,or how can i display all format of images in ImageView.
My xml code is
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/LinearLayout02_img"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal">
<WebView android:id="@+id/ads_content"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
</WebView>
</LinearLayout>
and My java code is
private WebView ads_content; ads_content = (WebView) findViewById(R.id.ads_content); ads_content.loadUrl(url);
Refer the screenshot which shows my output
i have to show the image upto the device level, thai is to block that white and black empty spaces Thanks
Upvotes: 2
Views: 5016
Reputation: 75750
You can try Setting the WebView Layout to Single Column. It resizes all images to screen-width automatically.
webview.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
From my answer here.
Upvotes: 0
Reputation: 12027
Hai Friends, Finally i got the solution for this problem, refer my xml code
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/LinearLayout02_img"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="center"
android:layout_alignParentBottom="true"
android:background="@color/black"
android:layout_alignParentLeft="true">
<WebView android:id="@+id/ads_content"
android:layout_gravity="center"
android:scaleType="centerInside"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:adjustViewBounds="true">
</WebView>
</LinearLayout>
Upvotes: 4