为什么关闭wifi时图片还在?怎么修改?
public class MainActivity extends AppCompatActivity { private ToggleButton TB; private RadioButton RB1,RB2,RB3; private RadioGroup RG; private ImageView imageView1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.work); initView(); setListener(); } public void setListener(){ RG.setOnCheckedChangeListener(new one()); TB.setOnClickListener(new two()); } class one implements RadioGroup.OnCheckedChangeListener { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { switch (checkedId){ case R.id.RB1: imageView1.setImageResource(R.drawable.office); break; case R.id.RB2: imageView1.setImageResource(R.drawable.meeting); break; case R.id.RB3: imageView1.setImageResource(R.drawable.visitor); break; } imageView1.setVisibility(View.VISIBLE); } } class two implements View.OnClickListener{ @Override public void onClick(View v) { if(TB.isChecked()){ RG.setVisibility(View.VISIBLE); }else { RG.setVisibility(View.GONE); imageView1.setVisibility(View.GONE); RB1.setChecked(false); RB2.setChecked(false); RB3.setChecked(false); } } } private void initView() { TB=(ToggleButton)findViewById(R.id.TB); RB1=(RadioButton)findViewById(R.id.RB1); RB2=(RadioButton)findViewById(R.id.RB2); RB3=(RadioButton)findViewById(R.id.RB3); RG=(RadioGroup)findViewById(R.id.RG); imageView1=(ImageView)findViewById(R.id.IV1); } }
1
收起
正在回答 回答被采纳积分+1
1回答
Android零基础入门2018版
- 参与学习 人
- 提交作业 5461 份
- 解答问题 7238 个
此次推出的专题为Android攻城狮培养计划的第一部分语法与界面基础篇,将带大家从0开始学习Android开发。
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星