An existed Layout can not be resolved to a field

2019-09-16 12:31发布

I have a customised view, and at certain moment of the game I am developing, I want to show a confirmation message to the user. For the confirmation message, I created a new xml file in the layout folder, and in the cistomised view og the game I am trying to refer to that layout as follows:

private void showConfirmation() {

LayoutInflater mLayoutInf = LayoutInflater.from(this.mContext);
View confMSG_View = mLayoutInf.inflater(R.layout.confirm_msg, null);
.....
.....
}

But, at this step, eclipse underscores the R.Layout.confirm_msg with red and says it can not be resolved to a field.

Please let me know what I am doing wrong here.

0条回答
登录 后发表回答