當前位置: 首頁>>代碼示例>>Java>>正文


Java ToggleButton.setEnabled方法代碼示例

本文整理匯總了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);
}
 
開發者ID:sdrausty,項目名稱:buildAPKsApps,代碼行數:11,代碼來源:ToggleSettingRenderer.java

示例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;
}
 
開發者ID:SKT-ThingPlug,項目名稱:thingplug-sdk-android,代碼行數:38,代碼來源:SensorListActivity.java

示例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;
        }
 
開發者ID:SKT-ThingPlug,項目名稱:thingplug-sdk-android,代碼行數:44,代碼來源:SensorListActivity.java

示例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;
        }
 
開發者ID:SKT-ThingPlug,項目名稱:thingplug-app-android,代碼行數:44,代碼來源:SensorListActivity.java


注:本文中的android.widget.ToggleButton.setEnabled方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。