【问题标题】:Swipe Refresh Layout and a WebView in a ScrollView在 ScrollView 中滑动刷新布局和 WebView
【发布时间】:2018-09-29 16:33:00
【问题描述】:

我在 ScrollView 的 LinearLayout 中有一个标题文本和一个 webView。我想添加一个Swipe Refresh Layout,但是我不知道该放在哪里,因为我总是出错或者页面不显示。

<?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>

【问题讨论】:

    标签: java android android-webview android-scrollview swiperefreshlayout


    【解决方案1】:

    试试这个方法,希望对你有用。

    <?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>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-11-03
      • 2017-11-28
      • 1970-01-01
      相关资源
      最近更新 更多