使android listview布局可滚动

Dav*_*d C 6 java layout user-interface android listview

我有一个xml文件,其格式为ASCII格式:

---------------
| ImageView
--------------
| TextView
--------------
| List...
--------------

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:myapp="http://schemas.android.com/apk/res/com.some.app"
 android:orientation="vertical" android:layout_width="fill_parent"
 android:layout_height="fill_parent">
<ImageView 
android:id="@+id/MovieCover"
android:layout_width="100dip"
android:layout_height="100dip"
/> 
 <TextView
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:textSize="16sp"
    android:padding="10dp"
    android:id="@+id/TextHeader"
    android:background="#000000">
</TextView>
<ListView android:id="@+id/ListView02" android:layout_height="wrap_content"
 android:layout_width="fill_parent">
 </ListView>
 </LinearLayout>
Run Code Online (Sandbox Code Playgroud)

当我的ImageView和TextView占据屏幕的3/4以上时,我在显示布局时遇到问题.如何使用正在显示的ListView使ImageView和TextView可滚动?此时,只有要滚动的ListView,我希望整个布局可以滚动,就像它们本身就是一个页​​面一样.

我怎样才能做到这一点?

And*_*ong 3

您可以用作<ScrollView>布局容器

沿着线的东西

<ScrollView>
    <LinearLayout>
    // your layout here
    </LinearLayout>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)

我们之所以需要里面的 LinearLayout 是因为 ScrollView 只能有一个直接子级