java - 在 ScrollView 中滑动刷新布局和 WebView
问题描述
我在 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>
解决方案
试试这个方法,我希望它对你有用。
<?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>
推荐阅读
- vue.js - 如何将primevue css文件添加到JHipster Project
- instagram - Instagram 基本显示 API 连接错误
- python - 将 [("['str']", int), ("['str']", int)] 类型的列表转换为 [('str', int), ('str', int)]
- python - 如何获取创建对象的文件的源代码?
- c++ - 在 C++ 中使用派生类型覆盖成员函数
- php - 雄辩的只获得第一个主动查询
- python-3.x - python multiprocessing - 未使用预期参数调用的方法
- android - 如何在我的 android 应用程序源代码的特定页面上获取 webview(加载 url)?
- javascript - 如何在 JavaScript 中检查图像中是否存在颜色
- kentico - Kentico 12 Azure 搜索