webview inside NestedScrollView inside CoordinatorLayout do not show content competely

时间:2016-06-18 20:03:42

标签: android webview android-nestedscrollview

I have a webview inside NestedScrollView inside CoordinatorLayout . the problem is in android 5 the full content do not shown . I use this solution and this solution but it did not work . what is the problem with my code?

XML:

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.design.widget.AppBarLayout
    android:id="@+id/appbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:fitsSystemWindows="true"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

    <android.support.design.widget.CollapsingToolbarLayout
        android:id="@+id/collapsing_toolbar"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true"
        app:contentScrim="?attr/colorPrimary"
        app:expandedTitleMarginEnd="64dp"
        app:expandedTitleMarginStart="48dp"
        app:layout_scrollFlags="scroll|exitUntilCollapsed">

        <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="fill_parent"
            android:layout_height="match_parent">

            <com.android.volley.toolbox.NetworkImageView
                android:id="@+id/img_circleThumbnail1"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:adjustViewBounds="true"
                android:scaleType="fitCenter"
                android:visibility="invisible"
                app:layout_collapseMode="parallax">

            </com.android.volley.toolbox.NetworkImageView>


            <ir.whc.news.views.CustomFontTextView
                android:id="@+id/tv_title_news"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="bottom"
                android:gravity="center"
                android:shadowColor="#000"
                android:shadowDx="1"
                android:shadowDy="3"
                android:shadowRadius="5"
                android:text="title"
                android:textSize="20sp"
                android:textStyle="bold"
                app:fontName="@string/byaken" />
        </FrameLayout>

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="@dimen/abc_action_bar_default_height_material"
            app:layout_collapseMode="pin"
            app:popupTheme="@style/AppTheme.PopupOverlay"></android.support.v7.widget.Toolbar>
    </android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>

<android.support.v4.widget.SwipeRefreshLayout
    android:id="@+id/swipe_refresh_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">


    <android.support.v4.widget.NestedScrollView
        android:layout_gravity="fill_vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="ir.whc.news.views.FixedScrollingViewBehavior">

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

            <LinearLayout

                android:id="@+id/content_layput"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical"
                android:visibility="invisible">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal">


                    <include layout="@layout/custom_txt_date"></include>

                    <View
                        android:layout_width="0dp"
                        android:layout_height="0dp"
                        android:layout_weight="1" />

                    <ir.whc.news.views.CustomFontTextView
                        android:id="@+id/tv_cnt_eye"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:paddingLeft="6dp"
                        android:textAppearance="?android:attr/textAppearanceSmall"
                        android:textColor="@color/textColorPrimary2"
                        android:textSize="11sp"
                        app:fontName="@string/byaken" />

                    <com.beardedhen.androidbootstrap.AwesomeTextView
                        android:id="@+id/fontAwesomeText1"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="16dp"
                        android:layout_marginRight="16dp"
                        android:textColor="#FFF"
                        app:fontAwesomeIcon="fa_eye" />


                </LinearLayout>

                <View
                    android:layout_width="match_parent"
                    android:layout_height="1dp"
                    android:background="@android:color/darker_gray" />

                <ir.whc.news.views.CustomFontTextView
                    android:id="@+id/tv_sum_news"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="center"
                    android:lineSpacingExtra="15dp"
                    android:paddingBottom="20dp"
                    android:paddingLeft="5dp"
                    android:paddingRight="5dp"
                    android:textAppearance="?android:attr/textAppearanceSmall"
                    app:fontName="@string/byaken" />


                <FrameLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:minHeight="500dp">

                    <WebView
                        android:id="@+id/webView1"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:background="@android:color/transparent"
                        android:clickable="true"
                        android:scrollbars="vertical"
                        android:textAlignment="center"
                        android:textDirection="rtl" />
                </FrameLayout>

            </LinearLayout>

            <LinearLayout
                android:id="@+id/content_problem_layout"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:visibility="invisible">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_margin="20dp"
                    android:gravity="center"
                    android:text="@string/connection_problem"
                    android:textColor="@color/blue_1" />
            </LinearLayout>
        </FrameLayout>

    </android.support.v4.widget.NestedScrollView>

</android.support.v4.widget.SwipeRefreshLayout>

<android.support.design.widget.FloatingActionButton
    android:id="@+id/fab"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom|right"
    android:layout_marginBottom="20dp"
    android:layout_marginRight="20dp"
    android:src="@drawable/ic_bookmark_white_normal"
    app:fabSize="normal" />

this is my incomplete text inside webview: enter image description here

1 个答案:

答案 0 :(得分:0)

If i am getting you right i think u should use android:fitsSystemWindows=“true”

or if not can you show the incomplete content your webview rendering???