Android ScrollView高度太短
我是Android新手,在创建一个滚动视图时遇到了这个问题,这个滚动视图应该是滚动10+个项目的列表视图Android ScrollView高度太短,android,scrollview,Android,Scrollview,我是Android新手,在创建一个滚动视图时遇到了这个问题,这个滚动视图应该是滚动10+个项目的列表视图 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.naqishop.naqi.MainActivity"
tools:showIn="@layout/activity_main">
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/scrollView">
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/listView"
android:entries="@array/options" />
</ScrollView>
</LinearLayout>
正如建议的那样
但它并没有改变高度。因此,感谢您的提示。这是因为您已经设置了
android:layout\u height=“wrap\u content”
。换成
android:layout\u height=“match\u parent”
它将占据整个高度。这是因为您设置了android:layout\u height=“wrap\u content”
。换成
android:layout\u height=“match\u parent”
将占据整个高度。您不能使用android:layout\u height=“wrap\u content”
来查看滚动视图(将其设置为android:layou height=“match\u parent”)“
您不需要滚动视图。只需删除它。只需使用ListView。它内部包含滚动。@MichaelKatkov观点很好。谢谢!您不能使用android:layout\u height=“wrap\u content”
来查看滚动视图
:-(将其设置为android:layout\u height=“match\u parent”“
您不需要ScrollView。只需将其删除。只需使用ListView。它内部包含scroll。@MichaelKatkov观点正确。谢谢!
android:fillViewport="true"