简体   繁体   English

SetContentView(Resource.Layout.V2T)CS0117错误'Resource.Layout'不包含'V2T'的定义

[英]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.

相关问题 CS0117 C#“Resource”不包含“Drawable”的定义 - CS0117 C# 'Resource' does not contain a definition for 'Drawable' Xamarin 'Resource.Layout' 不包含 'Tabbar' 错误的定义 - Xamarin 'Resource.Layout' does not contain a definition for 'Tabbar' error CS0117 C# “Resource.Id”不包含“PhoneNumberText”的定义 - CS0117 C# 'Resource.Id' does not contain a definition for "PhoneNumberText" 资产/脚本/Quıt.cs(10,21):错误 CS0117:“应用程序”不包含“Quıt”的定义 - Assets/Scripts/Quıt.cs(10,21): error CS0117: 'Application' does not contain a definition for 'Quıt' 错误CS0117:“ BindingFlags”不包含“ GetProperty”的定义 - error CS0117: 'BindingFlags' does not contain a definition for 'GetProperty' 错误CS0117:Namespace.A不包含接口的定义 - Error CS0117: Namespace.A does not contain definition for Interface 错误 CS0117:“级别”不包含“实例”的定义 - error CS0117: 'Level' does not contain a definition for 'Instance' C# 错误 CS0117:“数组”不包含 - C# error CS0117: 'Array' does not contain a definition for 错误CS0117(“调试”不包含“日志”的定义) - ERROR CS0117 ('Debug' does not contain a definition for 'log') 错误CS0117:“ EditorSceneManager”不包含“ IsGameObjectInScene”的定义 - error CS0117: 'EditorSceneManager' does not contain a definition for 'IsGameObjectInScene'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM