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


Java CompoundButton.setOnCheckedChangeListener方法代碼示例

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


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

示例1: onChildViewAdded

import android.widget.CompoundButton; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public void onChildViewAdded(View parent, View child) {
    if (parent == NestRadioGroup.this) {

        final List<CompoundButton> list = findCheckedView(child);
        for(CompoundButton view : list){
            if (view != null) {
                int id = view.getId();
                // generates an id if it's missing
                if (id == View.NO_ID && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
                    id = View.generateViewId();
                    view.setId(id);
                }
                view.setOnCheckedChangeListener(mChildOnCheckedChangeListener);
            }
        }

    }

    if (mOnHierarchyChangeListener != null) {
        mOnHierarchyChangeListener.onChildViewAdded(parent, child);
    }
}
 
開發者ID:RealMoMo,項目名稱:NestRadioGroup,代碼行數:27,代碼來源:NestRadioGroup.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: onCreate

import android.widget.CompoundButton; //導入方法依賴的package包/類
protected void onCreate(Bundle bundle)
   {
       super.onCreate(bundle);
       setContentView(R.layout.jni_main);
StatusBarUtil.setColor(this, getResources().getColor(R.color.colorPrimary));


       ViewWindow.showView(this, "");
       mCompoundButton = (CompoundButton) findViewById(R.id.sw_window);
       mCompoundButton.setOnCheckedChangeListener(this);
       if (getResources().getBoolean(R.bool.use_watching_service))
{
           startService(new Intent(this, WatchingService.class));
       }
   }
 
開發者ID:stytooldex,項目名稱:stynico,代碼行數:16,代碼來源:jni_string.java

示例4: bindEngineCheckboxesToMenu

import android.widget.CompoundButton; //導入方法依賴的package包/類
protected void bindEngineCheckboxesToMenu() {
    for (int i = 0; i < searchEngineGroup.getChildCount(); i++) {
        final CompoundButton engineButton = (CompoundButton) searchEngineGroup.getChildAt(i);
        engineButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                ((Activity) getContext()).invalidateOptionsMenu();
            }
        });
    }
}
 
開發者ID:mozilla-mobile,項目名稱:firefox-tv,代碼行數:12,代碼來源:MultiselectSearchEngineListPreference.java

示例5: bindView

import android.widget.CompoundButton; //導入方法依賴的package包/類
@Override
public void bindView(View view, Context context, Cursor cursor) {
    CompoundButton switchView = (CompoundButton) view.findViewById(R.id.repo_switch);

    // Remove old listener (because we are reusing this view, we don't want
    // to invoke the listener for the last repo to use it - particularly
    // because we are potentially about to change the checked status
    // which would in turn invoke this listener....
    switchView.setOnCheckedChangeListener(null);
    setupView(cursor, view, switchView);
}
 
開發者ID:uhuru-mobile,項目名稱:mobile-store,代碼行數:12,代碼來源:RepoAdapter.java

示例6: mapClickEvents

import android.widget.CompoundButton; //導入方法依賴的package包/類
private void mapClickEvents(final int position, final T item, DataMapping<T> mapping, View root)
{
    for (final ClickMapping<T> click : mapping.clickMappings) {
        View clickView = findViewByIdPath(root, click.viewIdPath);
        
        if (clickView instanceof CompoundButton) {
            CompoundButton button = (CompoundButton)clickView;
            button.setOnCheckedChangeListener(new OnCheckedChangeListener() 
            {
                @Override
                public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) 
                {
                    if (!mBlockClicks) {
                        click.listener.onViewChecked(position, item, isChecked); 
                    }
                }
            });
        }
        else {
            clickView.setOnClickListener(new OnClickListener() 
            {
                @Override
                public void onClick(View view) 
                {
                    if (!mBlockClicks) {
                        click.listener.onViewClicked(position, item); 
                    }
                }
            });
        }
    }
}
 
開發者ID:suomenriistakeskus,項目名稱:oma-riista-android,代碼行數:33,代碼來源:AttributeAdapter.java

示例7: setOnCheckedChangeListener

import android.widget.CompoundButton; //導入方法依賴的package包/類
@Override
public MartianViewHolder setOnCheckedChangeListener(int viewId, CompoundButton.OnCheckedChangeListener listener) {
    CompoundButton view = getView(viewId);
    view.setOnCheckedChangeListener(listener);
    return this;
}
 
開發者ID:vsona,項目名稱:RxJava2RetrofitDemo,代碼行數:7,代碼來源:MartianViewHolder.java

示例8: onCheck

import android.widget.CompoundButton; //導入方法依賴的package包/類
public CompoundButton onCheck(int id, OnCheckedChangeListener listener) {
    CompoundButton checkable = (CompoundButton) find(id);
    checkable.setOnCheckedChangeListener(listener);
    return checkable;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:6,代碼來源:ViewFinder.java

示例9: setOnCheckedChangeListener

import android.widget.CompoundButton; //導入方法依賴的package包/類
/**
 * CheckBox, RadioButton, Switch, SwitchCompat, ToggleButton
 * ,AppCompatCheckBox, AppCompatRadioButton等都可以使用
 * 凡是繼承CompoundButton的都可以使用
 *
 * 最常使用的是CheckBox,RadioButton,SwitchCompat設置監聽
 */
public SuperRecyclerHolder setOnCheckedChangeListener(@IdRes int viewId,
    CompoundButton.OnCheckedChangeListener onCheckedChangeListener) {
    CompoundButton checkBox = retrieveView(viewId);
    checkBox.setOnCheckedChangeListener(onCheckedChangeListener);
    return this;
}
 
開發者ID:qinxiaoguai,項目名稱:SuperRecyclerViewAdapter,代碼行數:14,代碼來源:SuperRecyclerHolder.java

示例10: setOnCheckedChangeListener

import android.widget.CompoundButton; //導入方法依賴的package包/類
/**
 * Sets the on checked change listener of the view.
 *
 * @param viewId   The view id.
 * @param listener The checked change listener of compound button.
 * @return The BaseViewHolder for chaining.
 */
public BaseViewHolder setOnCheckedChangeListener(int viewId, CompoundButton.OnCheckedChangeListener listener) {
    CompoundButton view = getView(viewId);
    view.setOnCheckedChangeListener(listener);
    return this;
}
 
開發者ID:bigjelly,項目名稱:AndFast,代碼行數:13,代碼來源:BaseViewHolder.java

示例11: setOnCheckedChangeListener

import android.widget.CompoundButton; //導入方法依賴的package包/類
/**
 * Sets the on checked change listener of the view.
 *
 * @param viewId   The view id.
 * @param listener The checked change listener of compound button.
 * @return The BaseViewHolder for chaining.
 */
public BaseViewHolder setOnCheckedChangeListener(@IdRes int viewId, CompoundButton.OnCheckedChangeListener listener) {
    CompoundButton view = getView(viewId);
    view.setOnCheckedChangeListener(listener);
    return this;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:13,代碼來源:BaseViewHolder.java

示例12: setOnCheckedChangeListener

import android.widget.CompoundButton; //導入方法依賴的package包/類
/**
 * Sets the on checked change listener of the view.
 *
 * @param viewId The view id.
 * @param listener The checked change listener of compound button.
 * @return The BaseViewHolder for chaining.
 */
public BaseViewHolder setOnCheckedChangeListener(@IdRes int viewId, CompoundButton.OnCheckedChangeListener listener) {
    CompoundButton view = getView(viewId);
    view.setOnCheckedChangeListener(listener);
    return this;
}
 
開發者ID:GaoGersy,項目名稱:MultiSelecter,代碼行數:13,代碼來源:BaseViewHolder.java


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