告诉我一个方法,这样当按钮被按下时,发生一个动作(ImageView中的文字和图片发生变化),下一次同一个按钮被按下时,动作再次发生(ImageView中的文字和图片发生变化)以此类推。我看是这样的...
public void onClick(View AppCompatButton) {
switch (AppCompatButton.getId()) {
case R.id.btn_left:
switch (AppCompatButton.гетерТекстаВКнопке()){
case R.string.level_1_left:
svg_main.setImageResource(R.drawable.ic_blue_level_1);
svg_left.setImageResource(R.drawable.ic_blue_level_2_left);
svg_right.setImageResource(R.drawable.ic_blue_level_2_right);
btn_left.setText(R.string.level_2_1);
btn_right.setText(R.string.level_2_2);
break;
case R.string.level_2_1:
svg_main.setImageResource(R.drawable.ic_red_level_2_left);
svg_left.setImageResource(R.drawable.ic_default);
svg_right.setImageResource(R.drawable.ic_default);
btn_left.setText(R.string.level_3_left);
btn_right.setText(R.string.level_4_left);
tv.setText(R.string.arrow2);
break;
case R.string.level_3_left:
svg_main.setImageResource(R.drawable.ic_default);
svg_left.setImageResource(R.drawable.ic_blue_level_1);
svg_right.setImageResource(R.drawable.ic_red_level_1);
btn_left.setText(R.string.level_1_left);
btn_right.setText(R.string.level_1_right);
tv.setText(R.string.arrow);
break;