繁体   English   中英

在ScrollView中滑动刷新布局和WebView

[英]Swipe Refresh Layout and a WebView in a ScrollView

我在ScrollView的LinearLayout中有标题文本和webView。 我想添加“滑动刷新布局”,但我不知道应将其放置在何处,因为我总是会收到错误消息或未显示页面。

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

            <TextView
                style="@style/PageTitle"
                android:text="@string/news_in_fazekas" />

            <WebView
                android:id="@+id/newsWebView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

    </LinearLayout>

</ScrollView>

尝试这种方式,希望对您有用。

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/swiperefresh"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

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

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <TextView
                style="@style/PageTitle"
                android:text="@string/news_in_fazekasx" />
            <WebView
                android:id="@+id/newsWebView"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />

        </LinearLayout>

    </ScrollView>

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM