当前位置: 首页>>代码示例>>Java>>正文


Java CompoundButton.isChecked方法代码示例

本文整理汇总了Java中android.widget.CompoundButton.isChecked方法的典型用法代码示例。如果您正苦于以下问题:Java CompoundButton.isChecked方法的具体用法?Java CompoundButton.isChecked怎么用?Java CompoundButton.isChecked使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.CompoundButton的用法示例。


在下文中一共展示了CompoundButton.isChecked方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addView

import android.widget.CompoundButton; //导入方法依赖的package包/类
@Override
public void addView(View child, int index, ViewGroup.LayoutParams params) {
    if (child instanceof CompoundButton) {
        final CompoundButton button = (CompoundButton) child;
        if (button.isChecked()) {
            mProtectFromCheckedChange = true;
         int currentCheck = getExclusiveCheckedId();
            if (mExclusive && currentCheck != View.NO_ID) {
                setCheckedStateForView(currentCheck, false);
            }
            mProtectFromCheckedChange = false;
            addCheckedId(button.getId());
        }
    }

    super.addView(child, index, params);
}
 
开发者ID:rcketscientist,项目名称:ToggleButtons,代码行数:18,代码来源:ToggleGroup.java

示例2: checkedButton

import android.widget.CompoundButton; //导入方法依赖的package包/类
public static void checkedButton(CompoundButton compoundButton, boolean checked) {
    if (compoundButton == null) {
        return;
    }
    if (compoundButton.isChecked() == checked) {
        return;
    }
    CompoundButton.OnCheckedChangeListener onCheckedChangeListener =
            (CompoundButton.OnCheckedChangeListener) Reflect.getMember(CompoundButton.class,
                    compoundButton, "mOnCheckedChangeListener");
    compoundButton.setOnCheckedChangeListener(null);
    compoundButton.setChecked(checked);
    compoundButton.setOnCheckedChangeListener(onCheckedChangeListener);
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:15,代码来源:RModelAdapter.java

示例3: addView

import android.widget.CompoundButton; //导入方法依赖的package包/类
@Override
    public void addView(View child, int index, ViewGroup.LayoutParams params) {

        final List<CompoundButton> list = findCheckedView(child);
        for(CompoundButton view : list){
            if (view != null) {
                if (view.isChecked()) {
                    mProtectFromCheckedChange = true;
                    if (mCheckedId != -1) {
                        setCheckedStateForView(mCheckedId, false);
                    }
                    mProtectFromCheckedChange = false;
                    setCheckedId(view.getId());
                }
            }
        }
//        final CompoundButton view = findCheckedView(child);
//        if (view != null) {
//            if (view.isChecked()) {
//                mProtectFromCheckedChange = true;
//                if (mCheckedId != -1) {
//                    setCheckedStateForView(mCheckedId, false);
//                }
//                mProtectFromCheckedChange = false;
//                setCheckedId(view.getId());
//            }
//        }
        super.addView(child, index, params);
    }
 
开发者ID:RealMoMo,项目名称:NestRadioGroup,代码行数:30,代码来源:NestRadioGroup.java

示例4: onCheckedChanged

import android.widget.CompoundButton; //导入方法依赖的package包/类
@CheckedChange({R.id.daily_task_radio, R.id.weekly_task_radio, R.id.disposable_task_radio})
void onCheckedChanged(CompoundButton button) {
    ExpandableRelativeLayout relativeLayout = findExpandableLayoutOf(button);
    if (button.isChecked()) {
        relativeLayout.post(relativeLayout::expand);
    } else {
        relativeLayout.collapse();
    }

}
 
开发者ID:hyb1996,项目名称:Auto.js,代码行数:11,代码来源:TimedTaskSettingActivity.java

示例5: setButtonChecked

import android.widget.CompoundButton; //导入方法依赖的package包/类
private void setButtonChecked(final CompoundButton compoundButton, final boolean value) {
    if (compoundButton.isChecked() != value) {
        onSettingsChangeListener.mute();
        compoundButton.setChecked(value);
        compoundButton.jumpDrawablesToCurrentState();
        onSettingsChangeListener.unmute();
    }
}
 
开发者ID:dmitrikudrenko,项目名称:MDRXL,代码行数:9,代码来源:SettingsFragment.java

示例6: isCheckedAll

import android.widget.CompoundButton; //导入方法依赖的package包/类
public boolean isCheckedAll(String[] items) {
    int checkedCount = 0;
    for (int i = 0; i < getChildCount(); i++) {
        CompoundButton button = (CompoundButton) getChildAt(i);
        String tmp = button.getText().toString();
        for (String item : items) {
            if (tmp.equals(item) && button.isChecked()) {
                checkedCount++;
            }
        }
    }
    return checkedCount == items.length;
}
 
开发者ID:gzu-liyujiang,项目名称:GoodsSpec,代码行数:14,代码来源:TagViewGroup.java

示例7: getSelectedItems

import android.widget.CompoundButton; //导入方法依赖的package包/类
public List<TagValue> getSelectedItems() {
    List<TagValue> tagValues = new ArrayList<>();
    for (int i = 0; i < getChildCount(); i++) {
        CompoundButton button = (CompoundButton) getChildAt(i);
        if (button.isChecked()) {
            for (TagValue value : data) {
                if (value.getName().equals(button.getText().toString())) {
                    tagValues.add(value);
                    break;
                }
            }
        }
    }
    return tagValues;
}
 
开发者ID:gzu-liyujiang,项目名称:GoodsSpec,代码行数:16,代码来源:TagViewGroup.java

示例8: hasDividerBeforeChildAt

import android.widget.CompoundButton; //导入方法依赖的package包/类
/**
 * Determines where to position dividers between children. Note: this is an 'illegal' override
 * of a hidden method.
 *
 * @param childIndex Index of child to check for preceding divider
 * @return true if there should be a divider before the child at childIndex
 */
protected boolean hasDividerBeforeChildAt(int childIndex) {
    final CompoundButton child = (CompoundButton) getChildAt(childIndex);
    if (child == null)
        return false;
    if (child.getVisibility() == GONE)
        return false;
    final CompoundButton previous = getVisibleViewBeforeChildAt(childIndex);
    if (previous == null)
        return false;

    // If both are checked, add a divider
    return child.isChecked() && previous.isChecked();
}
 
开发者ID:rcketscientist,项目名称:ToggleButtons,代码行数:21,代码来源:ToggleGroup.java

示例9: getCheckedEngineIds

import android.widget.CompoundButton; //导入方法依赖的package包/类
public Set<String> getCheckedEngineIds() {
    final Set<String> engineIdSet = new HashSet<>();

    for (int i = 0; i < searchEngineGroup.getChildCount(); i++) {
        final CompoundButton engineButton = (CompoundButton) searchEngineGroup.getChildAt(i);
        if (engineButton.isChecked()) {
            engineIdSet.add((String) engineButton.getTag());
        }
    }
    return engineIdSet;
}
 
开发者ID:mozilla-mobile,项目名称:firefox-tv,代码行数:12,代码来源:MultiselectSearchEngineListPreference.java

示例10: atLeastOneEngineChecked

import android.widget.CompoundButton; //导入方法依赖的package包/类
public boolean atLeastOneEngineChecked() {
    for (int i = 0; i < searchEngineGroup.getChildCount(); i++) {
        final CompoundButton engineButton = (CompoundButton) searchEngineGroup.getChildAt(i);
        if (engineButton.isChecked()) {
           return true;
        }
    }
    return false;
}
 
开发者ID:mozilla-mobile,项目名称:firefox-tv,代码行数:10,代码来源:MultiselectSearchEngineListPreference.java


注:本文中的android.widget.CompoundButton.isChecked方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。