0

时,我有以下布局:滚动整个页面滚动列表视图

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:id="@+id/commentView" 
android:orientation="vertical" 
android:background="@color/gray" > 


<LinearLayout 
    android:id="@+id/thumbnail" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentLeft="true" 
    android:layout_below="@+id/relativeLayout1" 
    android:background="@color/white" 
    android:orientation="vertical" > 

    <TextView 
     android:id="@+id/title" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_margin="5dp" 
     android:text="O descriere titlu" 
     android:textAppearance="?android:attr/textAppearanceMedium" /> 

    <ImageView 
     android:id="@+id/list_image" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_margin="5dp" 
     android:adjustViewBounds="true" 
     android:src="@drawable/lion" /> 
</LinearLayout> 

<ListView 
    android:id="@+id/commentList" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentLeft="true" 
    android:layout_below="@+id/thumbnail" 
    android:divider="#b5b5b5" 
    android:dividerHeight="1dp" 
    android:listSelector="@drawable/list_selector" > 

</ListView> 

在线性布局我打开一个半个屏幕画面和我填充一些textViews列表视图。我想滚动整个页面,包括当我滚动listView时的图片。 我的意思是,如果我足够滚动,我希望列表视图在整个屏幕上展开。 当前图像始终保持在同一个位置,并且列表视图可以在屏幕的一半上滚动。

回答

0

通过重写getViewTypeCountgetItemViewType,您可以在ListView中包含半屏图片,以根据基础数据列表中的对象类型加载适当的内容。

+1

http://stackoverflow.com/questions/5300962/getviewtypecount-and-getitemviewtype-methods-of-arrayadapter – exilonX 2014-09-30 20:32:54