當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。