当前位置: 首页>>代码示例>>Java>>正文


Java CheckBox类代码示例

本文整理汇总了Java中android.widget.CheckBox的典型用法代码示例。如果您正苦于以下问题:Java CheckBox类的具体用法?Java CheckBox怎么用?Java CheckBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CheckBox类属于android.widget包,在下文中一共展示了CheckBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import android.widget.CheckBox; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_network_details);

    CheckBox c = (CheckBox) findViewById(R.id.chk_show_pass_details);
    c.setOnCheckedChangeListener(this);

    Intent intent = getIntent();
    if (!intent.hasExtra(ActivityLauncher.EXTRA_APINFO)) {
        this.setResult(RESULT_CANCELED);
        this.finish();
        return;
    }

    this.currentNetwork = (AccessPointInfo) intent.getExtras().getSerializable(
                    ActivityLauncher.EXTRA_APINFO);
    if (this.currentNetwork == null) {
        this.setResult(RESULT_CANCELED);
        this.finish();
        return;
    }

    loadNetwork(false);

}
 
开发者ID:vaginessa,项目名称:RepWifiApp,代码行数:27,代码来源:NetworkDetailsActivity.java

示例2: onCreate

import android.widget.CheckBox; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.em_activity_new_group);
    groupNameEditText = (EditText) findViewById(R.id.edit_group_name);
    introductionEditText = (EditText) findViewById(R.id.edit_group_introduction);
    publibCheckBox = (CheckBox) findViewById(R.id.cb_public);
    memberCheckbox = (CheckBox) findViewById(R.id.cb_member_inviter);
    secondTextView = (TextView) findViewById(R.id.second_desc);

    publibCheckBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                secondTextView.setText(R.string.join_need_owner_approval);
            } else {
                secondTextView.setText(R.string.Open_group_members_invited);
            }
        }
    });
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:23,代码来源:NewGroupActivity.java

示例3: savePreferences

import android.widget.CheckBox; //导入依赖的package包/类
protected void savePreferences() {
	SharedPreferences.Editor editor = getPreferences(MODE_PRIVATE).edit();

       currencyPreferences.savePreferences(this, editor);

       long[] selectedIds = getSelectedAccountsIds();
       if (selectedIds.length > 0) {
           editor.putString(QIF_EXPORT_SELECTED_ACCOUNTS, joinSelectedAccounts(selectedIds));
       }

       Spinner dateFormats = (Spinner)findViewById(R.id.spinnerDateFormats);
	editor.putInt(QIF_EXPORT_DATE_FORMAT, dateFormats.getSelectedItemPosition());
       CheckBox uploadToDropbox = (CheckBox)findViewById(R.id.checkboxUploadToDropbox);
       editor.putBoolean(QIF_EXPORT_UPLOAD_TO_DROPBOX, uploadToDropbox.isChecked());

	editor.commit();
}
 
开发者ID:tiberiusteng,项目名称:financisto1-holo,代码行数:18,代码来源:QifExportActivity.java

示例4: ItemViewHolder

import android.widget.CheckBox; //导入依赖的package包/类
public ItemViewHolder(View itemView) {
    super(itemView);
    tile = itemView;
    imageView = (ImageView) itemView.findViewById(R.id.ivIcon);
    tvAmount = (TextView) itemView.findViewById(R.id.tvAmount);
    tvFirstLine = (TextView) itemView.findViewById(R.id.tvItemTileFirstLine);
    tvSecondLine = (TextView) itemView.findViewById(R.id.tvItemTileSecondLine);
    checkBox = (CheckBox) itemView.findViewById(R.id.cbCheck);
}
 
开发者ID:jam01,项目名称:LittleLight,代码行数:10,代码来源:ItemAdapter.java

示例5: initView

import android.widget.CheckBox; //导入依赖的package包/类
public void initView() {
    images = (List<LocalMedia>) getIntent().getSerializableExtra(EXTRA_PREVIEW_LIST);
    selectImages = (List<LocalMedia>) getIntent().getSerializableExtra(EXTRA_PREVIEW_SELECT_LIST);
    maxSelectNum = getIntent().getIntExtra(EXTRA_MAX_SELECT_NUM, 9);
    position = getIntent().getIntExtra(EXTRA_POSITION, 1);

    barLayout = (LinearLayout) findViewById(R.id.bar_layout);
    selectBarLayout = (RelativeLayout) findViewById(R.id.select_bar_layout);

    toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitle((position + 1) + "/" + images.size());
    setSupportActionBar(toolbar);
    toolbar.setNavigationIcon(R.mipmap.ic_back);


    doneText = (TextView) findViewById(R.id.done_text);
    onSelectNumChange();

    checkboxSelect = (CheckBox) findViewById(R.id.checkbox_select);
    onImageSwitch(position);


    viewPager = (PreviewViewPager) findViewById(R.id.preview_pager);
    viewPager.setAdapter(new SimpleFragmentAdapter(getSupportFragmentManager()));
    viewPager.setCurrentItem(position);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:27,代码来源:ImagePreviewActivity.java

示例6: onCreate

import android.widget.CheckBox; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	getActionBar().setDisplayHomeAsUpEnabled(true);
	setContentView(R.layout.activity_settings);
	pm = getPackageManager();
	
	startAtBoot = (CheckBox) findViewById(R.id.startup_at_boot);
	
	showReconnectMessage = (CheckBox) findViewById(R.id.show_reconnect_message);
	sendControlMode = (CheckBox) findViewById(R.id.send_control_mode);
	gba400CleanNotification = (CheckBox) findViewById(R.id.gba400_clean_notification);
	disableServer = (CheckBox) findViewById(R.id.disableServerOption);
	startCameraButton = (Button)findViewById(R.id.start_camera);
	startCameraButton.setOnClickListener(new StartCameraButtonListener(this));
	
	notificationsAccessButton = (Button)findViewById(R.id.notifications_config_button);
	notificationsAccessButton.setOnClickListener(new NotificationsConfigButtonListener(this));
	
	try {
		loadConfiguration();
	} catch(JSONException e) {
		ConfigurationManager.showConfigurationError(getApplicationContext());
		finish();
	}
}
 
开发者ID:masterjc,项目名称:bluewatcher,代码行数:27,代码来源:SettingsActivity.java

示例7: readPrefs

import android.widget.CheckBox; //导入依赖的package包/类
private void readPrefs()
{
    SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
    ((CheckBox)findViewById(R.id.rbStevenBlack)).setChecked(settings.getBoolean("StevenBlacks", false));
    ((CheckBox)findViewById(R.id.cbPorn)).setChecked(settings.getBoolean("StevenBlacksPorn", false));
    ((CheckBox)findViewById(R.id.cbSocial)).setChecked(settings.getBoolean("StevenBlacksSocial", false));
    ((CheckBox)findViewById(R.id.cbFakeNews)).setChecked(settings.getBoolean("StevenBlacksFakeNews", false));
    ((CheckBox)findViewById(R.id.cbGambling)).setChecked(settings.getBoolean("StevenBlacksGambling", false));
    ((CheckBox)findViewById(R.id.rbHostsFileNet)).setChecked(settings.getBoolean("HostsFileNet", true));

    if(settings.getBoolean("StevenBlacks", false))
    {
        ((CheckBox)findViewById(R.id.cbSocial)).setTextColor(Color.BLACK);
        ((CheckBox)findViewById(R.id.cbSocial)).setEnabled(true);

        ((CheckBox)findViewById(R.id.cbFakeNews)).setTextColor(Color.BLACK);
        ((CheckBox)findViewById(R.id.cbFakeNews)).setEnabled(true);

        ((CheckBox)findViewById(R.id.cbGambling)).setTextColor(Color.BLACK);
        ((CheckBox)findViewById(R.id.cbGambling)).setEnabled(true);

        ((CheckBox)findViewById(R.id.cbPorn)).setTextColor(Color.BLACK);
        ((CheckBox)findViewById(R.id.cbPorn)).setEnabled(true);
    }
}
 
开发者ID:LV-Crew,项目名称:Adblocker-for-Android,代码行数:26,代码来源:MainActivity.java

示例8: check1

import android.widget.CheckBox; //导入依赖的package包/类
public void check1(View view) {

        //checkbox 1
        CheckBox mandarino_uno = (CheckBox) findViewById(R.id.vota1);
        //checkbox 2
        CheckBox mandarino_due = (CheckBox) findViewById(R.id.vota2);
        //checkbox 3
        CheckBox mandarino_tre = (CheckBox) findViewById(R.id.vota3);

        mandarino_uno_checked=mandarino_uno.isChecked();

        if(mandarino_uno_checked) {
            orange = 1;
            mandarino_due.setChecked(false);
            mandarino_tre.setChecked(false);

        }else{
            orange=0;
        }
    }
 
开发者ID:Francescopaolo44,项目名称:AndroidApp-Deploy,代码行数:21,代码来源:Mandarini.java

示例9: LightSettings

import android.widget.CheckBox; //导入依赖的package包/类
LightSettings(List<CheckBox> checkBoxes) {
    String lights = null;
    String colors = null;
    for (CheckBox cb : checkBoxes) {
        if (cb.isChecked()) {
            if (lights == null) {
                lights = String
                        .valueOf(((int[]) cb.getTag())[0]);
                colors = String
                        .valueOf(((int[]) cb.getTag())[1]);
            } else {
                lights += "," + ((int[]) cb.getTag())[0];
                colors += "," + ((int[]) cb.getTag())[1];
            }
        }
    }
    this.lights = Util.toIntArray(lights);
    this.colors = Util.toIntArray(colors);
}
 
开发者ID:j4velin,项目名称:HueNotifier,代码行数:20,代码来源:LightSettings.java

示例10: createView

import android.widget.CheckBox; //导入依赖的package包/类
@Override
protected View createView(ViewGroup parent) {
    View view = LayoutInflater.from(parent.getContext())
            .inflate(R.layout.check_option, parent, false);

    TextView titleText = (TextView) view.findViewById(R.id.preference_check_title);
    final TextView detailText = (TextView) view.findViewById(R.id.preference_check_body);
    final CheckBox toggle = (CheckBox) view.findViewById(R.id.preference_check_toggle);

    titleText.setText(getTitle());
    detailText.setText(getDescription(isToggled()));
    toggle.setChecked(isToggled());

    view.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            toggle.setChecked(!isToggled());
        }
    });

    toggle.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            onSwitchToggle(isChecked);
            detailText.setText(getDescription(isChecked));
        }
    });

    return view;
}
 
开发者ID:marverenic,项目名称:Options,代码行数:31,代码来源:CheckOption.java

示例11: initView

import android.widget.CheckBox; //导入依赖的package包/类
private void initView() {
    this.mInputAccountLayout = (RelativeLayout) this.mRootView.findViewWithTag("umgr_login_layout_input_username");
    this.mInputAccount = (EditText) this.mRootView.findViewWithTag("umgr_login_input_username");
    this.mClearInputAccount = (Button) this.mRootView.findViewWithTag("umgr_login_clear_input_username");
    this.mInputPassword = (EditText) this.mRootView.findViewWithTag("umgr_login_input_password");
    this.mClearInputPassword = (Button) this.mRootView.findViewWithTag("umgr_login_clear_input_password");
    this.mRegister = (TextView) this.mRootView.findViewWithTag("umgr_login_register");
    this.mFindpwd = (TextView) this.mRootView.findViewWithTag("umgr_login_findpwd");
    this.mErrorPrompt = (TextView) this.mRootView.findViewWithTag("umgr_login_error_prompt");
    this.mLogin = (Button) this.mRootView.findViewWithTag("umgr_login_submit");
    this.mAgreeClause1 = (TextView) this.mRootView.findViewWithTag("umgr_agree_clause_1");
    this.mAgreeClauseUser = (TextView) this.mRootView.findViewWithTag("umgr_agree_clause_2_user");
    this.mAgreement = (TextView) this.mRootView.findViewWithTag("umgr_agree_clause_2_agreement");
    this.mAnd = (TextView) this.mRootView.findViewWithTag("umgr_agree_clause_2_and");
    this.mPrivacy = (TextView) this.mRootView.findViewWithTag("umgr_agree_clause_2_privacy");
    this.mShowPwd = (CheckBox) this.mRootView.findViewWithTag("umgr_login_show_password");
    this.mSwitchAccount = (TextView) this.mRootView.findViewWithTag("umgr_login_switch");
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:19,代码来源:LoginActivity.java

示例12: onCreate

import android.widget.CheckBox; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    //Initiate layout elements
    radioGroup_q1 = (RadioGroup) findViewById(R.id.radioGroup_q1);
    radioGroup_q2 = (RadioGroup) findViewById(R.id.radioGroup_q2);
    radioGroup_q3 = (RadioGroup) findViewById(R.id.radioGroup_q3);
    radioGroup_q4 = (RadioGroup) findViewById(R.id.radioGroup_q4);
    radioGroup_q5 = (RadioGroup) findViewById(R.id.radioGroup_q5);
    radioGroup_q6 = (RadioGroup) findViewById(R.id.radioGroup_q6);
    checkBox_7a = (CheckBox) findViewById(R.id.checkBox_7a);
    checkBox_7b = (CheckBox) findViewById(R.id.checkBox_7b);
    checkBox_7c = (CheckBox) findViewById(R.id.checkBox_7c);
    editText_name = (EditText) findViewById(R.id.editText_name);
}
 
开发者ID:Keixaz,项目名称:All-about-water,代码行数:18,代码来源:MainActivity.java

示例13: initTaskView

import android.widget.CheckBox; //导入依赖的package包/类
@Override
protected void initTaskView(LinearLayout llTaskContainer) {
	View taskView = View.inflate(context, R.layout.remind_edit_ahead_dialog, null);
	taskView.findViewById(R.id.read_cancel).setOnClickListener(this);
	taskView.findViewById(R.id.read_confirm).setOnClickListener(this);
	cbs[0]=(CheckBox)taskView.findViewById(R.id.read_fr7);
	cbs[0].setTag("7");
	cbs[1]=(CheckBox)taskView.findViewById(R.id.read_fr5);
	cbs[1].setTag("5");
	cbs[2]=(CheckBox)taskView.findViewById(R.id.read_fr3);
	cbs[2].setTag("3");
	cbs[3]=(CheckBox)taskView.findViewById(R.id.read_fr1);
	cbs[3].setTag("1");

	llTaskContainer.addView(taskView);
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:17,代码来源:RemindEditAheadDialog.java

示例14: showColorPickerDialog

import android.widget.CheckBox; //导入依赖的package包/类
private void showColorPickerDialog(final CheckBox cb, final TextView tv, final int[] tag) {
    ColorPickerDialog dialog = new ColorPickerDialog(
            MainActivity.this,
            tag[1]);
    dialog.setOnColorChangedListener(
            new ColorPickerDialog.OnColorChangedListener() {
                @Override
                public void onColorChanged(int color) {
                    tv.setTextColor(color);
                    tag[1] = color;
                    cb.setTag(tag);
                    startService(new Intent(MainActivity.this,
                            ColorFlashService.class)
                            .putExtra("lights", new int[]{tag[0]})
                            .putExtra("colors", new int[]{color})
                            .putExtra("flashOnlyIfLightsOn", false));
                }
            });
    dialog.show();
}
 
开发者ID:j4velin,项目名称:HueNotifier,代码行数:21,代码来源:MainActivity.java

示例15: deselectAll

import android.widget.CheckBox; //导入依赖的package包/类
private void deselectAll() {
    mCheckedPositions.clear();
    handleFabShow();

    // 取消所有 Bean 内记录的选中状态
    for (RequestBean bean : mApps) {
        bean.isCheck = false;
    }

    // 当前可见的所有 Item 取消选择
    for (int i = 0; i < rvApp.getChildCount(); i++) {
        View childAt = rvApp.getChildAt(i);
        CheckBox cbCheck = (CheckBox) childAt.findViewById(R.id.cb_check);
        cbCheck.setChecked(false);
    }
}
 
开发者ID:iAcn,项目名称:MBEStyle,代码行数:17,代码来源:RequestFragment.java


注:本文中的android.widget.CheckBox类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。