Android系统Webview更新后的Android WebView渲染问题

时间:2016-09-28 11:51:46

标签: android html android-webview rendering

我在Android系统WebView更新后面临Android设备上的Webview渲染问题。 Webview正在屏幕外呈现。有关详细信息,请查看屏幕截图。

enter image description here

有没有人有同样的问题?

任何帮助将不胜感激。谢谢。

请按要求查看xml文件:

       <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">


<include
    android:id="@+id/toolbar"
    layout="@layout/toolbar" />


<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/fragment_back_color">


    <ScrollView
        android:id="@+id/offerDetailScrollView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fillViewport="true"
        android:layout_above="@+id/installTextView">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginBottom="10dp"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:layout_marginTop="10dp">

            <android.support.v7.widget.CardView
                android:id="@+id/card_offer"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">

                    <LinearLayout
                        android:id="@+id/topViewDealDisplay"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:background="@color/white"
                        android:gravity="center"
                        android:orientation="vertical"
                        android:paddingBottom="10dp"
                        android:paddingTop="10dp">

                        <ImageView
                            android:id="@+id/dealImageView"
                            android:layout_width="45dp"
                            android:layout_height="45dp"
                            android:layout_centerInParent="true"
                            android:layout_margin="5dp"></ImageView>


                        <com.spiceladdoo.views.LatoRegularTextView
                            android:id="@+id/dealNameTextView"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:gravity="center"
                            android:padding="4dp"
                            android:text=""
                            android:textColor="@color/text_color"
                            android:textSize="18sp" />

                        <com.spiceladdoo.views.LatoRegularTextView
                            android:id="@+id/offerTitleTextView"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:gravity="center"
                            android:padding="4dp"
                            android:text="deal titile"
                            android:textColor="@color/lower_text_color"
                            android:textSize="18sp"
                            android:visibility="gone" />


                        <com.spiceladdoo.views.LatoRegularTextView
                            android:id="@+id/offerTypeTextView"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginLeft="10dp"
                            android:layout_marginRight="10dp"
                            android:ellipsize="end"
                            android:gravity="center"
                            android:maxLines="2"
                            android:text=""
                            android:textColor="@color/lower_text_color"
                            android:textSize="14sp" />
                    </LinearLayout>

                    <FrameLayout
                        android:id="@+id/frameLayoutAmount"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentRight="true"
                        android:layout_alignParentTop="true"
                        android:layout_marginTop="20dp"
                        android:clickable="true"
                        android:focusable="true"
                        android:gravity="right">

                        <ImageView
                            android:id="@+id/iv_rupee_bg"
                            android:layout_width="70dp"
                            android:layout_height="30dp"
                            android:layout_marginRight="-15dp"
                            android:background="@drawable/deals_image_background" />

                        <com.spiceladdoo.views.LatoRegularTextView
                            android:id="@+id/tv_amount"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center"
                            android:gravity="center"
                            android:paddingLeft="4dp"
                            android:textAppearance="?android:attr/textAppearanceMedium"
                            android:textColor="#ffffff"
                            android:textSize="17sp" />
                    </FrameLayout>
                </RelativeLayout>
            </android.support.v7.widget.CardView>


            <android.support.v7.widget.CardView
                android:id="@+id/cardview_descImage"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/card_offer"
                android:layout_marginTop="10dp"
                android:paddingBottom="5dp"
                android:paddingTop="5dp">


                <ImageView
                    android:id="@+id/dealDescriptionImageView"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:adjustViewBounds="true"
                    android:src="@null"
                    android:visibility="visible" />
            </android.support.v7.widget.CardView>


            <android.support.v7.widget.CardView
                android:id="@+id/cardview_shortDesc"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_below="@id/cardview_descImage"
                android:layout_marginTop="10dp"
                android:padding="5dp">


                <WebView
                    android:id="@+id/shortDescWebView"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:visibility="visible" />
            </android.support.v7.widget.CardView>


            <com.spiceladdoo.views.LatoBoldTextView
                android:id="@+id/related_offer_text"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@id/cardview_shortDesc"
                android:layout_gravity="center"
                android:layout_marginRight="10dp"

                android:text="SIMILAR OFFERS"
                android:textColor="@color/text_color"
                android:textSize="13sp" />

            <android.support.v7.widget.RecyclerView
                android:id="@+id/recyclerViewoffers"
                android:layout_width="match_parent"
                android:layout_height="100dp"
                android:layout_below="@id/related_offer_text"
                android:layout_marginTop="10dp"
                android:scrollbars="none" />

            <ProgressBar
                android:id="@+id/shortDescriptionProgress"
                style="?android:attr/android:progressBarStyle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:visibility="visible" />

        </RelativeLayout>
    </ScrollView>

    <com.spiceladdoo.views.LatoRegularTextView
        android:id="@+id/installTextView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerInParent="true"
        android:layout_marginTop="5dp"
        android:background="@color/newFreeBColor"
        android:gravity="center"
        android:paddingBottom="15dp"
        android:paddingTop="15dp"
        android:text="INSTALL"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:textColor="#FFFFFF"
        android:textSize="16sp"
        android:textStyle="bold"
        android:visibility="visible" />


    <FrameLayout
        android:id="@+id/hint"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="gone">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_above="@+id/layoutInstallHint"
                android:background="#99000000"></RelativeLayout>

            <RelativeLayout
                android:id="@+id/layoutInstallHint"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:layout_centerInParent="true"
                android:background="#99000000">

                <com.spiceladdoo.views.LatoRegularTextView
                    android:id="@+id/installTextHint"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerInParent="true"
                    android:layout_marginBottom="15dp"
                    android:layout_marginTop="5dp"
                    android:background="@color/spice_laddooblue"
                    android:paddingBottom="10dp"
                    android:paddingLeft="80dp"
                    android:paddingRight="80dp"
                    android:paddingTop="10dp"
                    android:text="INSTALL"
                    android:textAppearance="?android:attr/textAppearanceSmall"
                    android:textColor="#FFFFFF"
                    android:textSize="15sp"
                    android:textStyle="bold"
                    android:visibility="visible" />
            </RelativeLayout>

            <com.spiceladdoo.views.LatoRegularTextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_above="@+id/imageViewHintPinIcon"
                android:layout_centerHorizontal="true"
                android:text="Click on Button"
                android:textColor="@color/white"
                android:textSize="18sp" />

            <ImageView
                android:id="@+id/imageViewHintPinIcon"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:layout_centerHorizontal="true"
                android:layout_marginBottom="50dp"
                android:src="@drawable/hint_pin_down" />
        </RelativeLayout>
    </FrameLayout>

</RelativeLayout>

1 个答案:

答案 0 :(得分:0)

我认为你在给webview的高度时犯了错误,你把它作为wrap_content而不是尝试match_parent并试一试

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">


<include
    android:id="@+id/toolbar"
    layout="@layout/toolbar" />


<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/fragment_back_color">


    <ScrollView
        android:id="@+id/offerDetailScrollView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fillViewport="true"
        android:layout_above="@+id/installTextView">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginBottom="10dp"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:layout_marginTop="10dp">

            <android.support.v7.widget.CardView
                android:id="@+id/card_offer"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">

                    <LinearLayout
                        android:id="@+id/topViewDealDisplay"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:background="@color/white"
                        android:gravity="center"
                        android:orientation="vertical"
                        android:paddingBottom="10dp"
                        android:paddingTop="10dp">

                        <ImageView
                            android:id="@+id/dealImageView"
                            android:layout_width="45dp"
                            android:layout_height="45dp"
                            android:layout_centerInParent="true"
                            android:layout_margin="5dp"></ImageView>


                        <com.spiceladdoo.views.LatoRegularTextView
                            android:id="@+id/dealNameTextView"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:gravity="center"
                            android:padding="4dp"
                            android:text=""
                            android:textColor="@color/text_color"
                            android:textSize="18sp" />

                        <com.spiceladdoo.views.LatoRegularTextView
                            android:id="@+id/offerTitleTextView"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:gravity="center"
                            android:padding="4dp"
                            android:text="deal titile"
                            android:textColor="@color/lower_text_color"
                            android:textSize="18sp"
                            android:visibility="gone" />


                        <com.spiceladdoo.views.LatoRegularTextView
                            android:id="@+id/offerTypeTextView"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginLeft="10dp"
                            android:layout_marginRight="10dp"
                            android:ellipsize="end"
                            android:gravity="center"
                            android:maxLines="2"
                            android:text=""
                            android:textColor="@color/lower_text_color"
                            android:textSize="14sp" />
                    </LinearLayout>

                    <FrameLayout
                        android:id="@+id/frameLayoutAmount"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentRight="true"
                        android:layout_alignParentTop="true"
                        android:layout_marginTop="20dp"
                        android:clickable="true"
                        android:focusable="true"
                        android:gravity="right">

                        <ImageView
                            android:id="@+id/iv_rupee_bg"
                            android:layout_width="70dp"
                            android:layout_height="30dp"
                            android:layout_marginRight="-15dp"
                            android:background="@drawable/deals_image_background" />

                        <com.spiceladdoo.views.LatoRegularTextView
                            android:id="@+id/tv_amount"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center"
                            android:gravity="center"
                            android:paddingLeft="4dp"
                            android:textAppearance="?android:attr/textAppearanceMedium"
                            android:textColor="#ffffff"
                            android:textSize="17sp" />
                    </FrameLayout>
                </RelativeLayout>
            </android.support.v7.widget.CardView>


            <android.support.v7.widget.CardView
                android:id="@+id/cardview_descImage"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/card_offer"
                android:layout_marginTop="10dp"
                android:paddingBottom="5dp"
                android:paddingTop="5dp">


                <ImageView
                    android:id="@+id/dealDescriptionImageView"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:adjustViewBounds="true"
                    android:src="@null"
                    android:visibility="visible" />
            </android.support.v7.widget.CardView>


            <android.support.v7.widget.CardView
                android:id="@+id/cardview_shortDesc"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_below="@id/cardview_descImage"
                android:layout_marginTop="10dp"
                android:padding="5dp">


                <WebView
                    android:id="@+id/shortDescWebView"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:visibility="visible" />
            </android.support.v7.widget.CardView>


            <com.spiceladdoo.views.LatoBoldTextView
                android:id="@+id/related_offer_text"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@id/cardview_shortDesc"
                android:layout_gravity="center"
                android:layout_marginRight="10dp"

                android:text="SIMILAR OFFERS"
                android:textColor="@color/text_color"
                android:textSize="13sp" />

            <android.support.v7.widget.RecyclerView
                android:id="@+id/recyclerViewoffers"
                android:layout_width="match_parent"
                android:layout_height="100dp"
                android:layout_below="@id/related_offer_text"
                android:layout_marginTop="10dp"
                android:scrollbars="none" />

            <ProgressBar
                android:id="@+id/shortDescriptionProgress"
                style="?android:attr/android:progressBarStyle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:visibility="visible" />

        </RelativeLayout>
    </ScrollView>

    <com.spiceladdoo.views.LatoRegularTextView
        android:id="@+id/installTextView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerInParent="true"
        android:layout_marginTop="5dp"
        android:background="@color/newFreeBColor"
        android:gravity="center"
        android:paddingBottom="15dp"
        android:paddingTop="15dp"
        android:text="INSTALL"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:textColor="#FFFFFF"
        android:textSize="16sp"
        android:textStyle="bold"
        android:visibility="visible" />


    <FrameLayout
        android:id="@+id/hint"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="gone">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_above="@+id/layoutInstallHint"
                android:background="#99000000"></RelativeLayout>

            <RelativeLayout
                android:id="@+id/layoutInstallHint"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:layout_centerInParent="true"
                android:background="#99000000">

                <com.spiceladdoo.views.LatoRegularTextView
                    android:id="@+id/installTextHint"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerInParent="true"
                    android:layout_marginBottom="15dp"
                    android:layout_marginTop="5dp"
                    android:background="@color/spice_laddooblue"
                    android:paddingBottom="10dp"
                    android:paddingLeft="80dp"
                    android:paddingRight="80dp"
                    android:paddingTop="10dp"
                    android:text="INSTALL"
                    android:textAppearance="?android:attr/textAppearanceSmall"
                    android:textColor="#FFFFFF"
                    android:textSize="15sp"
                    android:textStyle="bold"
                    android:visibility="visible" />
            </RelativeLayout>

            <com.spiceladdoo.views.LatoRegularTextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
               android:layout_above="@+id/imageViewHintPinIcon"
                android:layout_centerHorizontal="true"
                android:text="Click on Button"
                android:textColor="@color/white"
                android:textSize="18sp" />

            <ImageView
                android:id="@+id/imageViewHintPinIcon"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:layout_centerHorizontal="true"
                android:layout_marginBottom="50dp"
                android:src="@drawable/hint_pin_down" />
        </RelativeLayout>
    </FrameLayout>

</RelativeLayout>

或者如果这不起作用,那么您可以将scrollview放在cardview中,然后将webview放在卡片视图中