亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

為什么我不能實現OnClickListener方法,而老師可以呢?

package com.tang.sdudent;


import android.support.v7.app.ActionBarActivity;

import android.os.Bundle;

import android.view.Menu;

import android.view.MenuItem;

import android.widget.Button;



public class MainActivity extends ActionBarActivity {

private Button bt1;

private Button bt2;


? ? @Override

? ? protected void onCreate(Bundle savedInstanceState) {

? ? ? ? super.onCreate(savedInstanceState);

? ? ? ? setContentView(R.layout.activity_main);

? ? ? ??

? ? ? ? bt1 = (Button) findViewById(R.id.button1);

? ? ? ? bt2 = (Button) findViewById(R.id.button2);

? ? ? ??

bt1.setOnClickListener(l);

? ? }



? ? @Override

? ? public boolean onCreateOptionsMenu(Menu menu) {

? ? ? ? // Inflate the menu; this adds items to the action bar if it is present.

? ? ? ? getMenuInflater().inflate(R.menu.main, menu);

? ? ? ? return true;

? ? }


? ? @Override

? ? public boolean onOptionsItemSelected(MenuItem item) {

? ? ? ? // Handle action bar item clicks here. The action bar will

? ? ? ? // automatically handle clicks on the Home/Up button, so long

? ? ? ? // as you specify a parent activity in AndroidManifest.xml.

? ? ? ? int id = item.getItemId();

? ? ? ? if (id == R.id.action_settings) {

? ? ? ? ? ? return true;

? ? ? ? }

? ? ? ? return super.onOptionsItemSelected(item);

? ? }

}

class OnClickListener implements MyOnClickListener{

}


正在回答

1 回答

class OnClickListener implements MyOnClickListener{

}

這里寫反了吧


0 回復 有任何疑惑可以回復我~
#1

qq_萬事掛懷只會半途而廢_0 提問者

不好意思,粗心了,謝謝!
2017-09-18 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
Android攻城獅的第一門課(入門篇)
  • 參與學習       312517    人
  • 解答問題       4931    個

想快速掌握Android應用開發基礎,選擇學習這門課程就對了。

進入課程

為什么我不能實現OnClickListener方法,而老師可以呢?

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號