在 RelativeLayout 中找到视图的顺序

Find the order of the views in RelativeLayout

我有一个 RelativeLayout,其中包含一组按钮。在应用程序执行期间,按钮的顺序发生了变化。

如何找到onDestroy()中按钮的顺序?

for(int i = 0; i < parentLayout.getChildCount(); i++){
    View child = parentLayout.getChildAt(i);
    // other logic here
}