Android的activity实现了View.OnClickListener接口点击没有反应

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

private TextView dateTextview,weekTextview;
private ImageView imageview_setting;
private Button btn_quanbu,btn_woshi,btn_keting,btn_chufang,btn_weiyu;
private int day,month,year,week;
private String week_cn;
private ArrayList<Button> btnList = new ArrayList<Button>();


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.activity_main);


    initWidget();
    setDate();
}


@Override
public void onClick(View view) {
    switch (view.getId()){
        case R.id.imageview_setting:
            startActivity(new Intent().setClass(MainActivity.this,SettingActivity.class));
            break;
        case R.id.btn_quanbu:
            break;
        case R.id.btn_woshi:
            break;
        case R.id.btn_keting:
            break;
        case R.id.btn_chufang:
            break;
        case R.id.btn_weiyu:
            break;
        default:
            break;
    }
}


//控件初始化
public void initWidget(){
    dateTextview = (TextView) findViewById(R.id.date_textview);
    weekTextview = (TextView) findViewById(R.id.week_textview);
    imageview_setting = (ImageView) findViewById(R.id.imageview_setting);
    btn_quanbu = (Button) findViewById(R.id.btn_quanbu);
    btn_woshi = (Button) findViewById(R.id.btn_woshi);
    btn_keting = (Button) findViewById(R.id.btn_keting);
    btn_chufang = (Button) findViewById(R.id.btn_chufang);
    btn_weiyu = (Button) findViewById(R.id.btn_weiyu);
}
查看全部
Frankensteinly
Frankensteinly
2016/11/02 08:48
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

5个回复