Использование Visual Studio для разработки кроссплатформенного приложения Xamarin. У меня есть определенный код Android, который я добавил в специальную сборку Android. Я получаю ошибку CS0117 при попытке компиляции. У меня есть файл V2T.axml в папке Resources/layout. Строка в коде CS с ошибкой:
SetContentView(Resource.Layout.V2T);
Есть идеи, что не так?
Также получите еще 2 ошибки CS0117 для проблем с «Resource.Id» не содержит ошибок определения, но я определил эти два ресурса.
Любые идеи?
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:
<?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>
SetContentView(Resource.Layout.V2T);
? - person John Joe   schedule 19.04.2018