0

私のクラスは Manager を拡張し、の位置setPositionChild(Field f)を変更するように呼び出します。fメソッドを呼び出した後setPositionChild()、変更を確認できるように位置を適用するにはどうすればよいですか (つまり、再レイアウトと再ペイント)。

に電話しようとしましたがinvalidate()、うまくいきませんでした。

4

1 に答える 1

2

invalidate() just forces a repaint, it doesn't redo the whole layout, as you noticed.

You can force a relayout by going up to the parent Screen object, and calling invalidateLayout(). Forcing the layout will almost certainly call setPositionChild() on the field you are trying to move, so you will want to make sure the new field position is preserved by the manager layout code. This may mean you need to write a custom manager.

于 2012-12-06T04:16:30.573 に答える