页面设置

1 <ToggleButton
2         android:layout_width="wrap_content"
3         android:layout_height="wrap_content"
4         android:checked="true"
5         android:textOff="未选中时显示文本"
6         android:textOn="选中时显示文本" 
7         android:id="@+id/togbtn"
8         />

 

主是是下面的方法

1 togbtn.setOnCheckedChangeListener(new OnCheckedChangeListener() {            
2             @Override
3             public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
4                 // TODO Auto-generated method stub
5                 if(isChecked){
6                     //选中                }             }
7         });

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-09
  • 2022-12-23
  • 2021-12-27
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-08-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-03
  • 2021-09-07
  • 2022-12-23
相关资源
相似解决方案