本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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();
}
}
示例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();
}
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}