Amit Thaper
Amit Thaper

Reputation: 2137

webview in android

I am using the webview control in android to show the html content. But I face a problem that in webview I have to fix the height so thats why if html content contains less data then it wasted the space. Is there any solution to solve this problem that how can I show only same content as html has in the webview without any wasted space please help.

following xml i used to draw webview is this right? In this i give fix height to webview. if i am not giving fix height then it will show only 1 line data with scroll.

         <LinearLayout android:id="@+id/llweb" android:layout_width="fill_parent" android:scrollbars="vertical" android:background="@android:color/transparent" android:layout_height="500dip">
        <WebView android:id="@+id/helloWebView" android:layout_width="fill_parent" android:background="@android:color/transparent" android:layout_height="500dip"/>

    </LinearLayout>

thanks

Upvotes: 0

Views: 2739

Answers (2)

user2084974
user2084974

Reputation: 16

Use the "fill_parent" attribute for height and width in the webview.

Upvotes: 0

Octavian Helm
Octavian Helm

Reputation: 39604

Use android:layout_height="wrap_content" in your layout file on the WebView.

Upvotes: 1

Related Questions