我有一个问题
首先看这段伪代码
<RelativeLayout>
<Button android:id="@+id/toast_dialog_confirm"/>
<Button
android:id="@+id/toast_dialog_cancel"
android:layout_toLeftOf="@+id/toast_dialog_confirm" />
</RelativeLayout>
要实现的效果是【后面的一个Button放到前一个Btn的左边】
然后再看这段
<RelativeLayout>
<Button
android:id="@+id/toast_dialog_cancel"
android:layout_toLeftOf="@+id/toast_dialog_confirm" />
<Button
android:id="@+id/toast_dialog_confirm"/>
</RelativeLayout>
确实以上两段都可以实现目标功能
但是第二段代码会不会有隐患,会不会因为XML的读取顺序出现“toast_dialog_confirm”找不到的情况
就是会不会出现那种【还未读取到这个Btn但已经引用了这个Btn的错误】
需要说明的是这两个Btn都已经写到了代码中
首先看这段伪代码
<RelativeLayout>
<Button android:id="@+id/toast_dialog_confirm"/>
<Button
android:id="@+id/toast_dialog_cancel"
android:layout_toLeftOf="@+id/toast_dialog_confirm" />
</RelativeLayout>
要实现的效果是【后面的一个Button放到前一个Btn的左边】
然后再看这段
<RelativeLayout>
<Button
android:id="@+id/toast_dialog_cancel"
android:layout_toLeftOf="@+id/toast_dialog_confirm" />
<Button
android:id="@+id/toast_dialog_confirm"/>
</RelativeLayout>
确实以上两段都可以实现目标功能
但是第二段代码会不会有隐患,会不会因为XML的读取顺序出现“toast_dialog_confirm”找不到的情况
就是会不会出现那种【还未读取到这个Btn但已经引用了这个Btn的错误】
需要说明的是这两个Btn都已经写到了代码中