我有一个具有ASCII格式的布局的xml文件:
---------------
| 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>
我的ImageView和TextView占据屏幕的3/4以上时,显示布局时出现问题。如何使ImageView和TextView在显示的ListView上可滚动?此时,仅滚动ListView,并且我希望整个布局可滚动,就好像它们自己是一页一样。
我怎样才能做到这一点?
最佳答案
您可以使用<ScrollView>
作为布局容器
沿线的东西
<ScrollView>
<LinearLayout>
// your layout here
</LinearLayout>
</ScrollView>
我们之所以需要其中的LinearLayout的原因是ScrollView只能有一个直接子代