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


Java CompoundButton.getVisibility方法代碼示例

本文整理匯總了Java中android.widget.CompoundButton.getVisibility方法的典型用法代碼示例。如果您正苦於以下問題:Java CompoundButton.getVisibility方法的具體用法?Java CompoundButton.getVisibility怎麽用?Java CompoundButton.getVisibility使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.CompoundButton的用法示例。


在下文中一共展示了CompoundButton.getVisibility方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getVisibleViewBeforeChildAt

import android.widget.CompoundButton; //導入方法依賴的package包/類
CompoundButton getVisibleViewBeforeChildAt(int index) {
    index--;
    while (index >= 0)
    {
        final CompoundButton previous = (CompoundButton) getChildAt(index);
        if (previous.getVisibility() != GONE)
            return previous;
        index--;
    }
    return null;
}
 
開發者ID:rcketscientist,項目名稱:ToggleButtons,代碼行數:12,代碼來源:ToggleGroup.java

示例2: 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

示例3: setCheckable

import android.widget.CompoundButton; //導入方法依賴的package包/類
public void setCheckable(boolean checkable) {

        if (!checkable && mRadioButton == null && mCheckBox == null) {
            return;
        }

        if (mRadioButton == null) {
            insertRadioButton();
        }
        if (mCheckBox == null) {
            insertCheckBox();
        }

        // Depending on whether its exclusive check or not, the checkbox or
        // radio button will be the one in use (and the other will be otherCompoundButton)
        final CompoundButton compoundButton;
        final CompoundButton otherCompoundButton;

        if (mItemData.isExclusiveCheckable()) {
            compoundButton = mRadioButton;
            otherCompoundButton = mCheckBox;
        } else {
            compoundButton = mCheckBox;
            otherCompoundButton = mRadioButton;
        }

        if (checkable) {
            compoundButton.setChecked(mItemData.isChecked());

            final int newVisibility = checkable ? VISIBLE : GONE;
            if (compoundButton.getVisibility() != newVisibility) {
                compoundButton.setVisibility(newVisibility);
            }

            // Make sure the other compound button isn't visible
            if (otherCompoundButton.getVisibility() != GONE) {
                otherCompoundButton.setVisibility(GONE);
            }
        } else {
            mCheckBox.setVisibility(GONE);
            mRadioButton.setVisibility(GONE);
        }
    }
 
開發者ID:treasure-lau,項目名稱:CSipSimple,代碼行數:44,代碼來源:ListMenuItemView.java

示例4: setCheckable

import android.widget.CompoundButton; //導入方法依賴的package包/類
public void setCheckable(boolean checkable) {
    if (checkable || this.mRadioButton != null || this.mCheckBox != null) {
        CompoundButton compoundButton;
        CompoundButton otherCompoundButton;
        if (this.mItemData.isExclusiveCheckable()) {
            if (this.mRadioButton == null) {
                insertRadioButton();
            }
            compoundButton = this.mRadioButton;
            otherCompoundButton = this.mCheckBox;
        } else {
            if (this.mCheckBox == null) {
                insertCheckBox();
            }
            compoundButton = this.mCheckBox;
            otherCompoundButton = this.mRadioButton;
        }
        if (checkable) {
            int newVisibility;
            compoundButton.setChecked(this.mItemData.isChecked());
            if (checkable) {
                newVisibility = 0;
            } else {
                newVisibility = 8;
            }
            if (compoundButton.getVisibility() != newVisibility) {
                compoundButton.setVisibility(newVisibility);
            }
            if (otherCompoundButton != null && otherCompoundButton.getVisibility() != 8) {
                otherCompoundButton.setVisibility(8);
                return;
            }
            return;
        }
        if (this.mCheckBox != null) {
            this.mCheckBox.setVisibility(8);
        }
        if (this.mRadioButton != null) {
            this.mRadioButton.setVisibility(8);
        }
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:43,代碼來源:ListMenuItemView.java


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