LiftInspection.axmlMonoDroid의 onclick 그런 방법 오류
<Button
android:id="@+id/expandCollapse1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/expand_arrow"
android:text="Function/Controls"
android:textSize="20sp"
android:textColor="@android:color/white"
android:background="@drawable/expandCollapseButton"
android:gravity="center"
android:onClick="button_Click"/>
LiftInspection.cs 즉시
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.LiftInspection);
}
public void button_Click(View view)
{
Toast.MakeText(this, "Testing", ToastLength.Long).Show();
}
. 안드로이드 로그에서 "java.lang.IllegalStateException : id_expandCollapse1 '을 사용하는 android.widget.Button 뷰 클래스의 onClick 핸들러에 대한 cpecfieldapp.LiftInspection 활동 클래스에서 button_Click (View) 메서드를 찾을 수 없음"
xml에서 클릭 이벤트를 설정할 때 발견 한 모든 것만 내가하는 일을 보여줍니다. android : onClick을 XML에서 가져 와서 유일한 매개 변수가 해당 레이아웃을 구현하는 액티비티의 뷰인 public void를 갖는 것. 내가 뭘 놓치고 있니?
살아갈 4.1.0 알파 버전이 시나리오를 지원합니다. – jonp
4.10.2에서 작동하지 않으며 OP와 동일한 문제가 발생합니다. –