的「onClick」這是我的第一個應用程序,請幫我解決這個類型錯誤:未找到屬性資源標識符包「機器人」
類型錯誤:未找到屬性的「onClick」資源標識符包'機器人'
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<Button
android:id="@+id/button1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:onclick='buttonBtn'
></Button>
</RelativeLayout>
更改爲:安卓的onClick = 'buttonBtn' 在Android中使用它這就是所謂的Click事件中的Java文件 公共無效buttonBtn(查看視圖) { Toast.makeText(getApplicationContext(),「Buttan點擊「,1).show(); } –