android - 如何在滚动视图中显示两个列表视图
问题描述
我查看了多个示例,我也知道这不是好的做法,但是有没有人可以帮助我解决这个问题。我的第一个列表显示正确,但我的第二个列表已折叠并有自己的滚动视图。我想为整个页面而不是单个列表视图提供滚动视图。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".EtsiActivity">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginBottom="?android:attr/actionBarSize">>
<TextView
android:layout_height="20dp"
style="?android:attr/listSeparatorTextViewStyle"
android:text="ETSI ERROR COUNT"
android:id="@+id/StatusHeader"
android:textColor="@color/primary"
android:layout_marginTop="5dip"
android:layout_marginLeft="5dp" />
<ListView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/etsiStatus"
android:layout_below="@+id/StatusHeader"
android:gravity="center_horizontal">
</ListView>
<TextView
android:layout_height="20dp"
style="?android:attr/listSeparatorTextViewStyle"
android:text="TS MAP"
android:id="@+id/TSHeader"
android:textColor="@color/primary"
android:layout_marginTop="5dip"
android:layout_marginLeft="5dp"
android:layout_below="@id/etsiStatus"/>
<ListView android:id="@+id/TSList"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/TSHeader"
android:gravity="center_horizontal"
/>
</LinearLayout>
</ScrollView>
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
app:menu="@menu/bottom_navigation_menu"
android:background="?android:attr/windowBackground" />
</RelativeLayout>
解决方案
我相信aNestedScrollView
是你想要的。看看Android:ScrollView vs NestedScrollView
推荐阅读
- meta-tags - 如何在 vue CLI(SPA)中分享 Facebook 上的帖子和图像?
- javascript - 通过 IBM Watson Chatbot 触发身份验证
- angular - 角延迟加载不接受多个子路由来拥有参数
- python - 分离配置文件并拆分密钥收集在自己的文件中
- vue.js - Vue使用方法验证表单字段
- javascript - 如何修复谷歌地图中的信息窗口
- node.js - 数据源中的数据更新时如何更新 Mat 表视图
- ios - 使用我的 MapView 和在我的 viewController 中使用 iOS 中的 Mapbox 制作自定义 NavigationViewController
- php - Laravel:在 vliew 中显示相关的 json 文件
- android - 从活动访问服务方法