我有一個佈局(MenuLayout),其中我有一個textView(註銷)。我想在textView中添加一個點擊監聽器。我將這個佈局包含在另一個佈局中。在包含的佈局的文本視圖中添加點擊監聽器
下面是代碼
<p.FlyOutContainer xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/FlyOutContainer">
<include
layout="@layout/menuLayout"/>
<include
layout="@layout/Home" />
我寫單擊事件代碼註銷這樣
TextView logout = FindViewById<TextView> (Resource.Id.textViewLogout);
logout.Click += delegate {
Intent logOut = new Intent(this,typeof(MainActivity));
StartActivity(logOut);
};
但Click事件不工作。 任何人都可以告訴我解決方案我犯的錯誤。
這是我使用的源代碼的Link。
這是機器人?如果是的話,你正在使用原生android sdk和eclipse? –
是的,這是在android中,但在xamarin(語言c#)。 –