Android 开灯 关灯 checkbox Radio组件用法演示.rar

时间:2022-07-30 12:57:57
【文件属性】:
文件名称:Android 开灯 关灯 checkbox Radio组件用法演示.rar
文件大小:81KB
文件格式:RAR
更新时间:2022-07-30 12:57:57
Android源码-UI界面实例 Android 开灯 关灯 checkbox Radio组件用法演示,向大家展示了如何为CheckBox和RadioButton添加监听器及开关灯业务代码,通过单击不同的按钮,切换开灯图片和关灯图片,设置程序操作状态如下:   public void setBulbState(boolean state){   //设置图片状态   ImageView iv=(ImageView)findViewById(R.id.ImageView01);   iv.setImageResource((state)?R.drawable.bulb_on:R.drawable.bulb_off);   CheckBox cb=(CheckBox)this.findViewById(R.id.CheckBox01);   cb.setText((state)?R.string.off:R.string.on);   cb.setChecked(state);//设置复选框文字状态   RadioButton rb=(RadioButton)findViewById(R.id.off);   rb.setChecked(!state);   rb=(RadioButton)findViewById(R.id.on);   rb.setChecked(state);//设置单选按钮状态   }
【文件预览】:
codesc.net
----RadioButton()
--------.project(846B)
--------src()
--------AndroidManifest.xml(629B)
--------res()
--------assets()
--------gen()
--------default.properties(449B)
--------.classpath(280B)

网友评论