【问题标题】:How to display two list view inside a scroll view如何在滚动视图中显示两个列表视图
【发布时间】:2021-03-02 21:57:13
【问题描述】:

我查看了多个示例,我也知道这不是一个好习惯,但是有没有人可以帮助我解决这个问题。我的第一个列表显示正确,但我的第二个列表已折叠并有自己的滚动视图。我想要整个页面而不是单个列表视图的滚动视图。

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

【问题讨论】:

    标签: android xml


    【解决方案1】:

    我相信NestedScrollView 是您想要的。看看Android: ScrollView vs NestedScrollView

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-04-17
      • 2011-12-08
      • 1970-01-01
      • 1970-01-01
      • 2019-10-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多