0

Although, this question has already been asked here: Error: Android-XML:Placing a <WebView> in a parent element that uses a wrap_content size can lead to subtle bugs; use match_parent . But it didn't have any satisfactory answer.So I am asking it again. I have taken a webview in my xml width height and width as match_parent. But every time I open this page, it shows me error "Placing a <WebView> in a parent element that uses a wrap_content size can lead to subtle bugs; use match_parent".
Here is the code:

<WebView 
android:id="@+id/wbvw_questn"
android:layout_height="match_parent"
android:layout_width="match_parent"/>
Community
  • 1
  • 1
shaby
  • 1,301
  • 1
  • 15
  • 17
  • y cant u use relative layout? – M S Gadag Nov 03 '14 at 10:32
  • Obviously I can use relative layout, in fact this problem is also going to sort out once I am cleaning my project. But still I am curious to know, why this error is coming there? – shaby Nov 03 '14 at 10:35
  • hey buudy i hav pasted xml code in my workspace but im not gettin any error or warning to webview.. – M S Gadag Nov 03 '14 at 10:44
  • Hi Gadag, I have this webView in relative layout which has the height as "wrap_content", which I can not make "fill_parent". So in that case it is showing that error. – shaby Nov 04 '14 at 05:13
  • the link mentioned in your question. has been answered and accepted too.. check it out.. – M S Gadag Nov 04 '14 at 05:30
  • if that doesnt work...post your xml.. :) – M S Gadag Nov 04 '14 at 05:31

1 Answers1

0

If you are praising the WebView into a RelativeLayout, LinearLayout or whatever as a parent view, you will need to change the parent view's height to "match_parent" to get rid of this error.

For example, change something like this:

<LinearLayout 
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    ... />
    <WebView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        ... />
     ...
</LinearLayout>

into:

<LinearLayout 
     android:layout_width="match_parent"
     android:layout_height="match_parent"/>
     ...
     <WebView
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         ... />
     ...
</LinearLayout>
Daniel
  • 2,415
  • 3
  • 24
  • 34
Jessica Zeng
  • 324
  • 3
  • 5