本文整理汇总了Java中android.widget.ToggleButton.isChecked方法的典型用法代码示例。如果您正苦于以下问题:Java ToggleButton.isChecked方法的具体用法?Java ToggleButton.isChecked怎么用?Java ToggleButton.isChecked使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.ToggleButton
的用法示例。
在下文中一共展示了ToggleButton.isChecked方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: attachTranslation
import android.widget.ToggleButton; //导入方法依赖的package包/类
private void attachTranslation(View view, TargetTextType type, String result){
if (view instanceof EditText){
if(type == TargetTextType.Hint){
((EditText)view).setHint(result);
}else if(type == TargetTextType.Text){
((EditText)view).setText(result);
}
}else if (view instanceof ToggleButton){
ToggleButton toggle = (ToggleButton)view;
if(type == TargetTextType.TextOff){
toggle.setTextOff(result);
if(toggle.isChecked() == false){
toggle.setText(result);
}
}else if(type == TargetTextType.TextOn){
toggle.setTextOn(result);
if(toggle.isChecked() == true){
toggle.setText(result);
}
}else if(type == TargetTextType.Text){
toggle.setText(result);
}
}else if (view instanceof Switch){
Switch switchWidget = (Switch)view;
if(type == TargetTextType.TextOff){
switchWidget.setTextOff(result);
}else if(type == TargetTextType.TextOn){
switchWidget.setTextOn(result);
}else if(type == TargetTextType.Text){
switchWidget.setText(result);
}
}else if (view instanceof Button){
((Button)view).setText(result);
}else if (view instanceof TextView){
((TextView)view).setText(result);
}
}
示例2: onRotateButtonClicked
import android.widget.ToggleButton; //导入方法依赖的package包/类
@OnClick(R.id.rotate)
public void onRotateButtonClicked(ToggleButton button){
if(button.isChecked()){
xAxis.setAxisAlignment(AxisAlignment.Right);
yAxis.setAxisAlignment(AxisAlignment.Bottom);
} else{
xAxis.setAxisAlignment(AxisAlignment.Bottom);
yAxis.setAxisAlignment(AxisAlignment.Right);
}
}
示例3: onClick
import android.widget.ToggleButton; //导入方法依赖的package包/类
public void onClick(View v) {
mChildView = ~ mChildView & 0x1; // 0 or 1
final ToggleButton toggle = mToggle;
final RangeSetting setting = mSetting;
boolean checked = toggle.isChecked();
toggle.toggle(); // preserve state
setting.notifySwitchClicked(checked);
}