本文整理汇总了Java中android.widget.ToggleButton.setEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java ToggleButton.setEnabled方法的具体用法?Java ToggleButton.setEnabled怎么用?Java ToggleButton.setEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.ToggleButton
的用法示例。
在下文中一共展示了ToggleButton.setEnabled方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateView
import android.widget.ToggleButton; //导入方法依赖的package包/类
private void updateView() {
Setting setting = mSetting;
mTitle.setText(setting.titleId);
mDescr.setText(setting.descr);
mIcon.setImageResource(setting.iconId);
ToggleButton toggle = mToggle;
toggle.setChecked(setting.checked);
toggle.setEnabled(setting.enabled);
}
示例2: getView
import android.widget.ToggleButton; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View rowView = inflater.inflate(R.layout.sensor_list_item, parent, false);
LinearLayout itemLayout = (LinearLayout) rowView.findViewById(R.id.item_layout);
ImageView itemImageView = (ImageView) rowView.findViewById(R.id.item_image);
TextView itemNameView = (TextView) rowView.findViewById(R.id.item_name);
TextView itemStatus = (TextView) rowView.findViewById(R.id.item_status);
ToggleButton itemEnable = (ToggleButton) rowView.findViewById(R.id.item_enable);
ToggleButton itemActivate = (ToggleButton) rowView.findViewById(R.id.item_activate);
Button itemActuatorRun = (Button) rowView.findViewById(R.id.item_actuator_run);
itemActuatorRun.setVisibility(View.GONE);
final SensorInfo sensorInfo = sensorInfos.get(position);
itemImageView.setImageResource(sensorInfo.getType().getImage());
itemNameView.setText(sensorInfo.getType().getNickname());
itemEnable.setChecked(sensorInfo.isEnable());
if (sensorInfo.getType().getCategory() == SensorType.Category.ACTUATOR) {
itemStatus.setVisibility(View.GONE);
itemActivate.setVisibility(View.GONE);
}
else {
itemActivate.setEnabled(false);
itemStatus.setText(sensorInfo.toString());
itemActivate.setChecked(sensorInfo.isActivated());
}
// sensor item click
itemLayout.setTag(sensorInfo);
itemLayout.setOnClickListener(listItemClickListener);
// sensor enable button click
itemEnable.setTag(sensorInfo);
itemEnable.setOnClickListener(enableClickListener);
return rowView;
}
示例3: getView
import android.widget.ToggleButton; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View rowView = inflater.inflate(R.layout.sensor_list_item, parent, false);
LinearLayout itemLayout = (LinearLayout) rowView.findViewById(R.id.item_layout);
ImageView itemImageView = (ImageView) rowView.findViewById(R.id.item_image);
TextView itemNameView = (TextView) rowView.findViewById(R.id.item_name);
TextView itemStatus = (TextView) rowView.findViewById(R.id.item_status);
ToggleButton itemEnable = (ToggleButton) rowView.findViewById(R.id.item_enable);
ToggleButton itemActivate = (ToggleButton) rowView.findViewById(R.id.item_activate);
Button itemActuatorRun = (Button) rowView.findViewById(R.id.item_actuator_run);
itemEnable.setVisibility(View.GONE);
SensorInfo sensorInfo = sensorInfos.get(position);
itemImageView.setImageResource(sensorInfo.getType().getImage());
itemNameView.setText(sensorInfo.getType().getNickname());
// itemEnable.setChecked(sensorInfo.isEnable());
if (sensorInfo.getType().getCategory() == SensorType.Category.ACTUATOR) {
itemStatus.setVisibility(View.GONE);
itemActivate.setVisibility(View.GONE);
itemActuatorRun.setEnabled(sensorInfo.isActivated() && !sensorInfo.isSuspend());
}
else {
itemActuatorRun.setVisibility(View.GONE);
itemStatus.setText(sensorInfo.toString());
itemActivate.setChecked(sensorInfo.isActivated());
itemActivate.setEnabled(!sensorInfo.isSuspend());
}
// sensor item click
itemLayout.setTag(sensorInfo);
itemLayout.setOnClickListener(listItemClickListener);
// sensor activation button click
itemActivate.setTag(sensorInfo);
itemActivate.setOnClickListener(activateClickListener);
// actuator run button click
itemActuatorRun.setTag(sensorInfo);
itemActuatorRun.setOnClickListener(actuatorRunClickListener);
return rowView;
}
示例4: getView
import android.widget.ToggleButton; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View rowView = inflater.inflate(R.layout.sensor_list_item, parent, false);
LinearLayout itemLayout = (LinearLayout) rowView.findViewById(R.id.item_layout);
ImageView itemImageView = (ImageView) rowView.findViewById(R.id.item_image);
TextView itemNameView = (TextView) rowView.findViewById(R.id.item_name);
TextView itemStatus = (TextView) rowView.findViewById(R.id.item_status);
ToggleButton itemEnable = (ToggleButton) rowView.findViewById(R.id.item_enable);
ToggleButton itemActivate = (ToggleButton) rowView.findViewById(R.id.item_activate);
Button itemActuatorRun = (Button) rowView.findViewById(R.id.item_actuator_run);
itemEnable.setVisibility(View.GONE);
SensorInfo sensorInfo = sensorInfos.get(position);
itemImageView.setImageResource(sensorInfo.getType().getImage());
itemNameView.setText(sensorInfo.getType().getNickname());
// itemEnable.setChecked(sensorInfo.isEnable());
if (sensorInfo.getType().getCategory() == SensorType.Category.ACTUATOR) {
itemStatus.setVisibility(View.GONE);
itemActivate.setVisibility(View.GONE);
itemActuatorRun.setEnabled(!sensorInfo.isControlling()); // && !sensorInfo.isSuspend());
}
else {
itemActuatorRun.setVisibility(View.GONE);
itemStatus.setText(sensorInfo.toString());
itemActivate.setChecked(sensorInfo.isActivated());
itemActivate.setEnabled(!sensorInfo.isControlling()); // !sensorInfo.isSuspend());
}
// sensor item click
itemLayout.setTag(sensorInfo);
itemLayout.setOnClickListener(listItemClickListener);
// sensor activation button click
itemActivate.setTag(sensorInfo);
itemActivate.setOnClickListener(activateClickListener);
// actuator run button click
itemActuatorRun.setTag(sensorInfo);
itemActuatorRun.setOnClickListener(actuatorRunClickListener);
return rowView;
}