我在我的活動中有2 LinearLayout
s。排名第一的有ImageView
,另一個有ListView
。我在ListView
有很多項目。滾動ListView外的項目
我想要的是向下滾動整個頁面。所以當我向下滾動含有ImageView
的LinearLayout
應該會消失。
我將兩個版面高度設置爲wrap_content
,但我只能向下滾動ListView
,頂部LinearLayout
保持原樣。
如果不將ImageView
作爲項目放入ListView
,是否可以實現我想要的功能?
這裏是佈局;
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/imgMoviePoster"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginBottom="10dp"
android:scaleType="centerCrop"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ListView
android:id="@+id/lstMovies"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
你可以使用滾動視圖作爲父窗口,但是你必須以編程方式設置你的列表視圖的高度。你可以給你最高的線性佈局作爲你的列表視圖的頭來實現你想要的。 – dgngulcan