當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。