2013-09-21 3 views
1

Это мои первые приложения, пожалуйста, помогите мне исправить этот код. Настройка Кнопка не работаетИдентификатор ресурса не найден для атрибута 'onclick' в пакете 'android'

<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> 

+0

возможный дубликат [Нет идентификатора ресурса найдено для атрибута 'onClick' в пакете 'android'] (http://stackoverflow.com/questions/13596244/no-resource-identifier-found-for-attribute-onclick-in-package-android) –

+2

Этот вопрос не соответствует теме, потому что это опечатка. http://meta.stackexchange.com/questions/167342/close-all-the-typo-questions – laalto

ответ

0

Изменение android:onclick='buttonBtn' в android:onClick='buttonBtn'

И в вашем MainActivity, сделайте следующее:

public void buttonBtn(View view){ 
    //do your button function here 
} 
1

Изменить это в

android:onclick='buttonBtn' 

Для

android:onClick='buttonBtn' 

с является капитал не мало

Поскольку XML парсер Андроида является чувствительным к регистру

0

Ошибка возникает из-за орфографической ошибки в

 android:onClick='buttonBtn' 
Смежные вопросы