【发布时间】:2015-09-02 10:06:22
【问题描述】:
在我的应用程序中,我使用的是ListView,它位于NestedScrollView 内。当我将ListView 的height 设置为match_parent 时,它不会覆盖整个屏幕。我希望ListView 覆盖整个屏幕。
我的 XML 文件:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:isScrollContainer="false"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="fill_vertical"
android:clipToPadding="false"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingTop="1dp">
<ListView
android:id="@+id/list"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:divider="@null" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
【问题讨论】:
-
可以分享一下listview的截图和data吗?
-
对不起,我的名声不太好。添加屏幕截图至少需要 10 个声望。
-
正如@Reza 提到的,您不应该在另一个可滚动视图(如滚动视图)中使用像列表视图这样的可滚动视图。那么为什么要让 listview 在 NestedScrollView 中呢?
-
你在哪里使用这个嵌套滚动视图在其他布局中?...发布它
-
@RajenRaiyarela 我正在使用新的材料设计库开发应用程序。我希望我的工具栏在滚动列表视图时隐藏。所以我的应用程序必须使用 NestedtedScrollView。
标签: android xml listview nestedscrollview