滚动包含相对应的View的RelativeLayout

|| 我正在尝试制作可滚动的RelativeLayout,其中包含一些自定义视图。这是电影院的平面图,我有地方的x,y坐标以及它的宽度和高度(实际上只是矩形)。我只是将其放入此RelativeLayout中:
<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"
          android:layout_height=\"fill_parent\"
          android:layout_width=\"fill_parent\"
          android:padding=\"10px\">
<ScrollView
        android:layout_height=\"wrap_content\"
        android:layout_width=\"fill_parent\">
    <RelativeLayout android:id=\"@+id/scrollable_places\"
                    android:layout_height=\"wrap_content\"
                    android:layout_width=\"wrap_content\">
    </RelativeLayout>
</ScrollView>
我这样说:    
    RelativeLayout layout = (RelativeLayout) context.findViewById(R.id.scrollable_places);
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(place.getWidth(),
 place.getHeight());
    params.leftMargin = place.getX();
    params.topMargin = place.getY();
    layout.addView(new Seat(context, place), params);
座位类如下:
public class Seat extends View {

private Place place;
private boolean isRed = false;

public Seat(Context context, Place place) {
    super(context);
    this.place = place;
    setOnClickListener(new OnSeatClickListener());
}

@Override
protected void onDraw(Canvas canvas) {
    if (!isRed)
        canvas.drawColor(Color.GREEN);
    else
        canvas.drawColor(Color.RED);
}

    protected void setRed() {
        isRed = true;
    }

    private class OnSeatClickListener implements OnClickListener {

        @Override
        public void onClick(View view) {
            ((Seat) view).setRed();
            view.invalidate();
        }
    }
}
视图绘制完美。但是我有一个视图数组,当其中一些视图移出屏幕时,scrollView不起作用,屏幕上没有滚动。您有任何想法如何使此布局滚动?     
已邀请:
        您应该尝试以下xml文件。它将在所有设备上运行。
<ScrollView xmlns:android=\"http://schemas.android.com/apk/res/android\"
    android:fillViewport=\"true\"
    android:padding=\"10px\"
    android:layout_height=\"fill_parent\"
    android:layout_width=\"fill_parent\">
    <RelativeLayout android:id=\"@+id/scrollable_places\"
                android:layout_height=\"wrap_content\"
                android:layout_width=\"wrap_content\">
    </RelativeLayout>
</ScrollView>
谢谢。     
        在滚动视图中,您已编写
android:layout_height=\"wrap_content\"
,而不是使用wrap_content的五个特定高度大小,例如
android:layout_height=\"100dip\"
谢谢 迪帕克     

要回复问题请先登录注册