独自のレイアウトをコーディングしました (RelativeLayout のサブクラス化)。onMeasure() と onLayout() が継続的に呼び出されていることがデバッガーからわかります。それは正常な動作ですか?スタック トレースは、dispatchMessage() から始まります。
Synoptic.onMeasure(int, int) line: 125
Synoptic(View).measure(int, int) line: 12727
RelativeLayout.measureChildHorizontal(View, RelativeLayout$LayoutParams, int, int) line: 594
RelativeLayout.onMeasure(int, int) line: 376
RelativeLayout(View).measure(int, int) line: 12727
LinearLayout(ViewGroup).measureChildWithMargins(View, int, int, int, int) line: 4698
LinearLayout.measureChildBeforeLayout(View, int, int, int, int, int) line: 1369
LinearLayout.measureHorizontal(int, int) line: 1017
LinearLayout.onMeasure(int, int) line: 555
LinearLayout(View).measure(int, int) line: 12727
SwipeView(HorizontalScrollView).measureChildWithMargins(View, int, int, int, int) line: 1159
SwipeView(FrameLayout).onMeasure(int, int) line: 293
SwipeView(HorizontalScrollView).onMeasure(int, int) line: 303
SwipeView(View).measure(int, int) line: 12727
LinearLayout(ViewGroup).measureChildWithMargins(View, int, int, int, int) line: 4698
LinearLayout.measureChildBeforeLayout(View, int, int, int, int, int) line: 1369
LinearLayout.measureVertical(int, int) line: 660
LinearLayout.onMeasure(int, int) line: 553
LinearLayout(View).measure(int, int) line: 12727
LinearLayout.measureVertical(int, int) line: 812
LinearLayout.onMeasure(int, int) line: 553
LinearLayout(View).measure(int, int) line: 12727
FrameLayout(ViewGroup).measureChildWithMargins(View, int, int, int, int) line: 4698
FrameLayout.onMeasure(int, int) line: 293
FrameLayout(View).measure(int, int) line: 12727
LinearLayout(ViewGroup).measureChildWithMargins(View, int, int, int, int) line: 4698
LinearLayout.measureChildBeforeLayout(View, int, int, int, int, int) line: 1369
LinearLayout.measureVertical(int, int) line: 660
LinearLayout.onMeasure(int, int) line: 553
LinearLayout(View).measure(int, int) line: 12727
PhoneWindow$DecorView(ViewGroup).measureChildWithMargins(View, int, int, int, int) line: 4698
PhoneWindow$DecorView(FrameLayout).onMeasure(int, int) line: 293
PhoneWindow$DecorView.onMeasure(int, int) line: 2092
PhoneWindow$DecorView(View).measure(int, int) line: 12727
ViewRootImpl.performTraversals() line: 1068
ViewRootImpl.handleMessage(Message) line: 2446
ViewRootImpl(Handler).dispatchMessage(Message) line: 99
Looper.loop() line: 137
ActivityThread.main(String[]) line: 4424
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 511
ZygoteInit$MethodAndArgsCaller.run() line: 784
ZygoteInit.main(String[]) line: 551
NativeStart.main(String[]) line: not available [native method]
そしてここで onLayout():
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed, l, t, r, b);
if (changed) {
itemGrid.getLayoutParams().width = (int) itemSize;
itemGrid.getLayoutParams().height = (int) itemSize;
itemProduction.getLayoutParams().width = (int) itemSize;
itemProduction.getLayoutParams().height = (int) itemSize;
itemConsumption.getLayoutParams().width = (int) itemSize;
itemConsumption.getLayoutParams().height = (int) itemSize;
imageViewFlowAnimation.getLayoutParams().height = (int) animationHeight;
imageViewFlowAnimation.getLayoutParams().width = (int) animationWidth;
}
}