网页视图+的ListView一个覆盖在活动的其他
问题描述:
所以我有这个XML文件:网页视图+的ListView一个覆盖在活动的其他
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/viplounge"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<WebView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/wview"
android:orientation="vertical"
android:background="@android:color/black"
/>
<ListView
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:id="@+id/viplist"
android:layout_below="@id/wview"
/>
</RelativeLayout>
凡的WebView是从我的strings.xml加载文本,该文本采用HTML格式美好显示经验并且很安静,所以它不适合显示器,因此WebView是可滚动的。
在WebView(文本)下我正在解析一个XML文件,并显示一个ListView中显示的Internet的一些数据。
所以我的问题是,我无法得到我的WebView下面的ListView,我想像这样管理它:当我完成在我的WebView中滚动时,我想显示下面的ListView。所以用户必须停下Text/WebView,然后他才能从ListView中读取信息。
该应用程序基本上是描述一个位置,并在描述下应该有位置可用和不可用时的日期列表。只是为了让你知道我在这里做什么。
答
可以使用NestedScrollView
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/viplounge"
android:layout_width="match_parent"
android:layout_height="match_parent">
<WebView
android:id="@+id/wview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/black"
android:orientation="vertical" />
<ListView
android:id="@+id/viplist"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/wview" />
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
现在只显示我的ListView :( –
的第一行看到这个https://stackoverflow.com/a/34504747/3553815链接,你可以设置ListView的高度基地在它的孩子 – MHP