0
我是Android的新手,有這個問題,使滾動視圖應該滾動到10+項目的ListView上。Android ScrollView高度太短
<?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>
問題是我無法擴展滾動視圖來一次顯示多個項目。我試着用滾動視圖的layout_height
篡改(如分配值500dp
) 我也嘗試添加
android:fillViewport="true"
爲suggestd here 但它並沒有改變高度。所以感謝你的提示。
您無法使用'android:layout_height =「wrap_content」'ScrollView' :-( 將其設置爲android:layout_height =「match_parent」「' –
您不需要ScrollView。它只是使用ListView它包含滾動裏面 –
@MichaelKatkov好點,謝謝! – Karlom