[英]SetContentView(Resource.Layout.V2T) CS0117 Error 'Resource.Layout' does not contain a definition for 'V2T'
Using Visual Studio to develop a Xamarin cross platform APP. 使用Visual Studio开发Xamarin跨平台APP。 I have specific Android code I have added to the Android specific build.
我已将特定的Android代码添加到特定于Android的版本中。 I get the CS0117 error when trying to compile.
尝试编译时出现CS0117错误。 I have a 'V2T.axml' file in the Resources/layout folder.
我在Resources / layout文件夹中有一个“ V2T.axml”文件。 The line in the CS code with the error is:
CS代码中出现错误的行是:
SetContentView(Resource.Layout.V2T); SetContentView(Resource.Layout.V2T);
Any idea what is wrong? 知道有什么问题吗?
Also get 2 more CS0117 errors for problems with 'Resource.Id" does not contain definition errors - but I have defined those two resources. 对于'Resource.Id'的问题,还将获得2个CS0117错误,其中不包含定义错误-但我已定义了这两个资源。
Any ideas? 有任何想法吗?
CS: CS:
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// set the isRecording flag to false (not recording)
isRecording = false;
// Set our view to: V2T.axml
SetContentView(Resource.Layout.V2T);
// get the resources from the layout
recButton = FindViewById<Button>(Resource.Id.btnRecord);
textBox = FindViewById<TextView>(Resource.Id.textYourText);
V2T.axml: V2T.axml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:weightSum="3">
<LinearLayout
android:orientation="horizontal"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/linearLayout1"
android:layout_weight="1"
android:gravity="center">
<Button
android:text="Start Recording"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/btnRecord" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/linearLayout2"
android:layout_weight="1">
<TextView
android:text="Your text"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/textView1"
android:layout_marginLeft="5dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/textYourText"
android:textColor="#ffedf01d"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/linearLayout3"
android:layout_weight="1" />
</LinearLayout>
清理解决方案并重新构建,布局xml未成功构建应该解决它
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.