我有以下 xml,它下面有 Gridview 和 framelayout。 我的要求是如果我向上滚动屏幕整个屏幕应该滚动,但对我来说只有 ListView 滚动
下面是xml文件:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:focusableInTouchMode="true"
android:paddingBottom="@dimen/activity_vertical_margin">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/time_card_header"
android:id="@+id/scrollView">
<GridView
android:id="@+id/timecard_grid"
android:layout_width="match_parent"
android:layout_height="130dp"
android:layout_margin="3dp"
android:fitsSystemWindows="true"
android:gravity="center_horizontal"
android:horizontalSpacing="1dp"
android:numColumns="3"
android:stretchMode="columnWidth"
android:verticalSpacing="1dp" />
</ScrollView>
<FrameLayout
android:id="@+id/timecard_reports"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:background="@color/white"
android:layout_below="@+id/scrollView"/>
</RelativeLayout
最佳答案
其实GridView和Listview已经滚动了。无需将上述小部件放在 ScrollView 中。首先,删除 ScrollView 。我认为您需要将 FrameLayout 固定在底部并在上方显示 gridview。首先在线性布局中使用 FrameLayout 并设置 align_parentbottom 为真。之后请将 gridview 放在 FrameLayout 上方。这将解决问题。
关于java - 无法滚动下面有 GridView 和 ListView 的屏幕,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46412022/