resource.id不包含按钮和布局

时间:2017-10-12 07:32:39

标签: button layout xamarin.android

我在Xamarin上创建了一个Android项目,并在布局中添加了一个按钮,但是当我使用<创建按钮时,我有 Resource.Id的错误不包含Button的定义活动中的strong> FindViewById 。尽管使用(android:id =“@ + id / btnShow”)给按钮和布局的id,我仍然有错误。我检查了Resource.Designer,但找不到按钮的按钮。

我遇到的另一个问题是当我创建一个布局,给它并在一个活动中定义它,但 Resource.layout不包含布局的定义

但是,可以在我的活动中定义其他按钮和布局

1 个答案:

答案 0 :(得分:0)

Actually this problem occurs when your ResourceDesigner.cs file has not yet mapped the file that you added to your resource directory(Xamarin Bug). The easiest way i would suggest to handle this situation is you comment the code you are trying to write and clean build your project and it will work like a charm. Good luck!