【发布时间】:2016-01-28 04:48:59
【问题描述】:
当您在视图中有许多按钮并且所有按钮都有侦听器时。你的主要活动变脏了。 有人知道如何组织听众吗? 目前我使用这种方式并实现onClickListener。
spotify =(Button)findViewById(R.id.spotifyBtn);
superDuoBtn = (Button) findViewById(R.id.superDuoBtn);
libraryBtn = (Button) findViewById(R.id.libraryBtn);
buildBiggerBtn = (Button) findViewById(R.id.buildItBiggerBtn);
capstoneBtn= (Button) findViewById(R.id.capstoneApp);
spotify.setOnClickListener(this);
superDuoBtn.setOnClickListener(this);
libraryBtn.setOnClickListener(this);
buildBiggerBtn.setOnClickListener(this);
capstoneBtn.setOnClickListener(this);
【问题讨论】:
标签: android