CS0117 C# 'Resource.Id' does not contain a definition for “”

  • Thread starter Thread starter Eric Sol
  • Start date Start date
E

Eric Sol

Guest
Xamarin Android (Visual Studio 2019 with Xamarin

SigninActivity.cs

using System;
using Android.App;
using Android.OS;
using Android.Support.V7.App;
using Android.Util;
using Android.Widget;

namespace DBAndroid
{
[Activity(Theme = "@style/MyTheme.Login", NoHistory = true, Icon = "@mipmap/ic_launcher")]
public class SigninActivity : Activity
{
EditText email;
EditText password;
Button _button;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Signin);
email = FindViewById<EditText>(Resource.Id.txtEmail);
password = FindViewById<EditText>(Resource.Id.txtPassword);
//var button = FindViewById<FloatingActionButton>(Resource.Id);
_button = FindViewById<Button>(Resource.Id.btnSignin);

//_button.Click += DoLogin;
}
}
}

Signin.axml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:id="@+id/txtEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="电子邮件"
android:theme="@style/EditTextWhite"
android:inputType="textEmailAddress"
android:drawableLeft="@drawable/ic_lock" />
<EditText
android:id="@+id/txtPassword"
android:layout_marginTop="40dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="登录密码"
android:theme="@style/EditTextWhite"
android:inputType="textPassword"
android:drawableLeft="@drawable/ic_key" />
<Button
android:text="@string/Login"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/btnSignin"
android:layout_marginTop="50dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"/>
</LinearLayout>

Continue reading...
 
Back
Top