当前位置: 首页>>代码示例>>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;未经允许,请勿转载。