1

In my app i a displaying a webpage in webview, using url of webpage. The url loads fine but the issue is that some content of web page is cropped from bottom. How this issue can be fixed? Any help will be appreciated. Here is my code

xml code

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/app_bg_color"
    >
    <WebView
        android:id="@+id/webview"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <include
        layout="@layout/empty_result_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</RelativeLayout>

Java code

String Content = "<h2>" + ItemDetail.getTitle() + "</h2>\n" + ItemDetail.getWebviewContent();
Content = Content.replaceAll("a href=\"/", "a href=\"" + ConstantFile.SERVER_ADDRESS + "/");

webview.loadDataWithBaseURL(null, Content, "text/html", "UTF-8", null);
webview.getSettings().setDefaultTextEncodingName("UTF-8");
Mahesh Babariya
  • 4,560
  • 6
  • 39
  • 54
User
  • 692
  • 2
  • 11
  • 29

2 Answers2

0

try this use scrollview

<ScrollView
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:fillViewport="true"> 

  <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:tools="http://schemas.android.com/tools"
   android:id="@+id/container"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:background="@color/app_bg_color" >
    <WebView
      android:id="@+id/webview"
      android:layout_width="match_parent"
      android:layout_height="match_parent" />

   <include
      layout="@layout/empty_result_layout"
      android:layout_width="match_parent"
      android:layout_height="match_parent" />
   </RelativeLayout>

</ScrollView>
AskNilesh
  • 67,701
  • 16
  • 123
  • 163
0

Try giving the WebView a layout_weight="1" and height of 0dp.

AskNilesh
  • 67,701
  • 16
  • 123
  • 163
nebuchadnezzar I
  • 125
  • 1
  • 12